how to solve 'Error using | Matrix dimensions must agree. ' ?

1 vue (au cours des 30 derniers jours)
neda eskandari
neda eskandari le 18 Juin 2019
Commenté : neda eskandari le 18 Juin 2019
Hello Dears
i have the error that i mentioned in question and i do not know how i can solve it.
while (Lia2_One_Three ~= zeros(length(Lia2_One_Three),1) | Lia2_Two_Three ~= zeros(length(Lia2_Two_Three),1))
row_n2_three_step = randperm(length(area_2) / 2, n2_three_step_delayed_measurements) ;
Lia2_One_Three = ismember(row_n2_one_step, row_n2_three_step) ;
Lia2_Two_Three = ismember(row_n2_two_step, row_n2_three_step) ;
end
it seems that this error says that 'Lia2_One_Three ~= zeros(length(Lia2_One_Three)) ' and
' Lia2_Two_Three ~= zeros(length(Lia2_Two_Three))' should have same dimention. i just want to say that while the first condition or second condition is true, produce ' row_n2_three_step' again.
'Lia2_One_Three ' and ' Lia2_Two_Three ' are vectors with different dimentions.
  4 commentaires
neda eskandari
neda eskandari le 18 Juin 2019
please see 108 to 112 rows
neda eskandari
neda eskandari le 18 Juin 2019
Thank you Dear

Connectez-vous pour commenter.

Réponse acceptée

James Tursa
James Tursa le 18 Juin 2019
Modifié(e) : James Tursa le 18 Juin 2019
Maybe this line:
while (Lia2_One_Three ~= zeros(length(Lia2_One_Three),1) | Lia2_Two_Three ~= zeros(length(Lia2_Two_Three),1))
could be this instead?
while ( any(Lia2_One_Three(:)) || any(Lia2_Two_Three(:)) )
I'm guessing a bit on what I think you want the test to do.
Note that the ~= and | operators are element-wise operators, which I am guessing is not what you really want to use here.
  5 commentaires
James Tursa
James Tursa le 18 Juin 2019
The any( ) functions tests for nonzeros, so the ~=0 part in your proposed code is redundant.
neda eskandari
neda eskandari le 18 Juin 2019
thanks a lot

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by