n = 6;
f = zeros(n);
for i = n
if i <= n
f = i;
end
if f(i) == 1 || f(i) == 2
f(i - 1) = 1;
f(i - 2) = 1;
end
f(i) = f(i - 1) + f(i - 2);
end

回答 (1 件)

dpb
dpb 2018 年 8 月 12 日

0 投票

No idea what really trying to accomplish but
n = 6;
f = zeros(n); % f=nxn array zeros
for i = n % i=6
if i <= n % i==n so
f = i; % f=6 and the array f went away...
end
Now all the references to f as an array of other than 1x1 are invalid hence the error.
Tell us what you really are trying to do...

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

質問済み:

2018 年 8 月 12 日

回答済み:

dpb
2018 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by