how to use the for loop to simplify my array ? But I got the error In an assignment A(:) = B, the number of elements in A and B must be the same.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi , I try to use the matlab to express Xall
X1 = X + S(1,1)
X2 = X + S(2,1)
X3 = X + S(3,1)
X4 = X + S(4,1)
X5 = X + S(5,1)
X6 = X + S(6,1)
X7 = X + S(7,1)
X8 = X + S(8,1)
X9 = X + S(9,1)
X10 = X + S(10,1)
X11 = X + S(11,1)
X12 = X + S(12,1)
X13 = X + S(13,1)
X14 = X + S(14,1)
X15 = X + S(15,1)
X16 = X + S(16,1)
Xall = [X1;X2;X3;X4;X5;X6;X7;X8;X9;X10;X11;X12;X13;X14;X15;X16];
but I don't know how to use for loop to simplify it
I tried the
for n = 1:16
X(n) = X + S(n,1)
end
but it says A(:) = B, the number of elements in A and B must be the same.
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!