Receiving 'not enough input arguments' in code

1 view (last 30 days)
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

Answers (1)

the cyclist
the cyclist on 17 Feb 2020
Edited: the cyclist on 17 Feb 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.

Community Treasure Hunt

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

Start Hunting!