Receiving 'not enough input arguments' in code

1 次查看(过去 30 天)
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

回答(1 个)

the cyclist
the cyclist 2020-2-17
编辑:the cyclist 2020-2-17
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.

类别

Help CenterFile Exchange 中查找有关 Orange 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by