MATLAB Answers

For Loop Which Skips Numbers Based on Row Vector

4 ビュー (過去 30 日間)
Chad
Chad 2020 年 3 月 26 日
回答済み: Torsten 2020 年 3 月 26 日
I've got a row vector containing hunderds of random, ascending numbers. I need to run a for loop which skips these specific numbers. How do I write the counter?

  0 件のコメント

Sign in to comment.

採用された回答

David Hill
David Hill 2020 年 3 月 26 日
n=1:1000;%not sure how far you want your for-loop to go (max(rowVector)+?)
n=n(~ismember(n,rowVector));
for k=n %or 1:length(n) indexing n(k) inside the loop.

  0 件のコメント

Sign in to comment.

その他の回答 (1 件)

Torsten
Torsten 2020 年 3 月 26 日
Use "setdiff" to remove the row vector elements from the range of the for-loop and name the vector v.
Then simply type
for v
...
end

  0 件のコメント

Sign in to comment.


Translated by