"Local function name must be different from the script name" error
Afficher commentaires plus anciens
Hi, I wrote a simple code but I can't get output of the function because of this error. Name of the file is "main.m".
And it also says that this is a local function. Should I/how can I make it main function? The code is:
clear;
function [any, tri, sqr, rect] = main(number_of_sticks)
%This function will be used for finding if we can construct
%equilateral triangle/square/rectangle
tri=(rem(number_of_sticks,3)==0);
sqr=(rem(number_of_sticks,4)==0);
rect=(rem(number_of_sticks,2)==0);
any=(tri==1 || sqr==1 || rect==1);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Historical Contests dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!