Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Jan
Jan le 7 Avr 2017
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 commentaires
Pratik Anandpara
Pratik Anandpara le 8 Avr 2017
if v is matrix of 30*2 than which modification needed
Jan
Jan le 8 Avr 2017
You might need e.g. all(v(:)) to consider all elements.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by