Receiving 'not enough input arguments' in code

7 vues (au cours des 30 derniers jours)
Thomas Stowell
Thomas Stowell le 17 Fév 2020
Modifié(e) : the cyclist le 17 Fév 2020
I keep receiving error message on line 4 " not enough input arguements", not sure how to rectify.
function D=areavol(A)
format
D= 0; % where D=parallelogram
if size(A,2)== 2
D=1;
end
Rank =rank(A); %get rank
[rows,~]=size(A); % get rows
if rows>rank
if D==1
printf("parallelogram can't be built.\n")
else
printf("parallelpiped can't be built.\n")
end
D=0;
return;
end
>> areavol
Not enough input arguments.
Error in areavol (line 4)
if size(A,2)== 2

Réponses (1)

the cyclist
the cyclist le 17 Fév 2020
Modifié(e) : the cyclist le 17 Fév 2020
You need
rows>Rank
instead of
rows>rank
MATLAB is case-sensitive. It would be better to have named that variable something that is not a keyword (despite the different case). Then it would have been easier to catch that mistake (or never have made it in the first place).
Also, note that in the editor, MATLAB will have warned you (with a squiggly yellow line) that the variable Rank was never used.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by