フィルターのクリア

Keep getting the error "Index exceeds the number of array elements (1)"

2 ビュー (過去 30 日間)
Alexis Williams
Alexis Williams 2021 年 3 月 29 日
編集済み: per isakson 2021 年 3 月 29 日
Can someone please explain why I keep getting this error? Here is my code:
for Count = 1:100
fprintf('Count = %d\n', Count');
end
Wait = input('Press return to continue', 's');
x = 1;
while x <= 100 % test Count
disp(x)
x = x + 1; % modify Count
end
disp('Prime Numbers')
for num = 1:100
i = isprime(num);
primenum = num(i);
disp(primenum);
end
It is showing me that the error is located at the "primenum = num(i);" I am not sure why.

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by