Why is this while loop not working? Prime number from list
古いコメントを表示
clear;
close all
clc;
N = 10;
list=2:N;
values = [2];
list(find(mod(list,2)==0))=[];
tester = 3;
while list ~= []
list(find(mod(list,tester)==0))=[];
tester = list(1);
values = values + [, tester];
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Profile and Improve Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!