how to exclude or skip numbers in a for loop
82 ビュー (過去 30 日間)
古いコメントを表示
My code is look like this:
for i=1:12951;
frame=i;
path='.................................';
respath='........................................';
fname=[path,num2str(frame),'.txt'];
thresh=0.4;
picpath='...........................'
(I want to skip some frames value e.g:3147,3148 & 9319,9320 how can i do it?)
0 件のコメント
採用された回答
Lucademicus
2019 年 12 月 23 日
You should take a look at the function ismember
skipNum = [3147,3148,9319,9320];
for i = 1:12951;
if ~ismember(i,skipNum) % if i is not a member of the skipNum array
frame = i;
% further work your magic
end
end
5 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!