How to save a 1x2 matrix in a variable in each iteration?

4 Ansichten (letzte 30 Tage)
Siddique Tomal
Siddique Tomal am 13 Aug. 2016
Beantwortet: Amos am 13 Aug. 2016
%suppose x=[4 3];
c=[];
for ite=1:80
for run=1:10
c(ite,run)=x;
end
end
i know this will show ' Subscripted assignment dimension mismatch' but as i need to save the value of x matrix in every iteration with the change of ite and run what can i do for it? and yes obviously the value of x matrix is also changing though here x has been shown as constant.
  1 Kommentar
Image Analyst
Image Analyst am 13 Aug. 2016
You have a 1-by-2 matrix, and you want to save it somewhere in a 80-by-10 matrix. Where do you want to save it? In one place? In lots of places? If so, where? Like in columns 4 and 5 or where?????

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Amos
Amos am 13 Aug. 2016
I am not really sure what you want. Does the following do the trick?
c={};
for ite=1:80
for run=1:10
c{ite,run}=x;
end
end

Kategorien

Mehr zu Filename Construction 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!

Translated by