How to work with loops?
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hi,
I wrote down this code, however, it gives me the error " Arrays have incompatible sizes for this operation. Error in Code (line 5) row = find(X==i);"
X = [12 12 12 1 1 1 1 1]
for i= unique(X)
    row = find(X==i)
    for j=[row]
    i have some codings here
    end
end
Can you please help me? Thanks,
2 Kommentare
  David Hill
      
      
 am 18 Okt. 2022
				Runs fine.
X = [12 12 12 1 1 1 1 1];
a=[];
for i= unique(X)
    row = find(X==i);
    for j=row
     a=[a,5];
    end
end
a
Antworten (0)
Siehe auch
Kategorien
				Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

