any single vector element =0 than loop again rotate and again loop start from first line

2 ビュー (過去 30 日間)
30 element in vector check each value of vector and any element in vector =0 than loop again start from first step i want to go at first line of code if condition not satisfy , this vector is get after some process if any content is not zero than move forward and if any content is zero than again loop rotate

採用された回答

Jan
Jan 2017 年 4 月 7 日
I'm not sure, if I understand the question correctly. A guess:
ready = false;
while ~ready
... your code
v = randi([-10, 10], 1, 30); % Pseudo-data, use your vector instead
if all(v) % Stop loop if v does not contain any 0
ready = true;
end
end
  2 件のコメント
Pratik Anandpara
Pratik Anandpara 2017 年 4 月 8 日
if v is matrix of 30*2 than which modification needed
Jan
Jan 2017 年 4 月 8 日
You might need e.g. all(v(:)) to consider all elements.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by