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?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2014-6-4
Change:
p(i,:)=[x1-x2 x3-x2; x2-x3 x1-x3]
to:
p(i,:,:)=[x1-x2 x3-x2; x2-x3 x1-x3]
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!