Can someone explain to me why I'm getting "Not enough input arguments" in line 2

1 回表示 (過去 30 日間)
Leeroy Saenz
Leeroy Saenz 2021 年 9 月 8 日
回答済み: Walter Roberson 2021 年 9 月 9 日
function Fn = Fnorm(A)
[r,c] = size(A);
sum = 0;
for i=1:r
for j=1:c
sum = sum + (A(i,j) * A(i,j));
end
end
Fn = sqrt(sum);
end

回答 (2 件)

John D'Errico
John D'Errico 2021 年 9 月 9 日
For the simple reason that you named a function named size. Don't do this. Type this at the command line:
which size -all
If it shows a function that you created, change the name. And in the future, don't name things with names that already exist as useful tools in MATLAB.

Walter Roberson
Walter Roberson 2021 年 9 月 9 日
You tried to run your function, Fnorm, without passing any values into it. For example you might have tried to run it by pressing the green Run button. You need to go to the command line and pass it an array, such as
A = rand(5,7);
result = Fnorm(A)

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by