I face the error of "Subscripted assignment dimension mismatch." when i want to create a loop a matrix. my simple short code given below, plz help me?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mehedi
am 4 Jun. 2014
Beantwortet: Star Strider
am 4 Jun. 2014
clc clear x1=5; x2=3; x3=2; for i=1:3 if i==1 x1=6; elseif i==2 x1=7; elseif i==3 x1=8; end p(i,:)=[x1-x2 x3-x2; x2-x3 x1-x3] end
0 Kommentare
Akzeptierte Antwort
Star Strider
am 4 Jun. 2014
Change:
p(i,:)=[x1-x2 x3-x2; x2-x3 x1-x3]
to:
p(i,:,:)=[x1-x2 x3-x2; x2-x3 x1-x3]
0 Kommentare
Weitere 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!