How to store different results of for loop in same or different arrays, avoiding the overwriting of the results? (in MATLAB R2013b)

1 visualizzazione (ultimi 30 giorni)
A=[200 250 300 250];
Len(A)=length(A);
for k=1:1:(Len(A)-1)
T1=A(k);
T2=A(k+1);
end
j=1;
for i=1:1:L
if (T1<=Temp(i))&&(Temp(i)<=T2)
array(j,1)=i;
j=j+1;
end
end
L1=length(array);
for j=1:1:L1
a=array(j);
X(j,1)=P(a);
X(j,2)=Q(a);
X(j,3)=R(a);
X(j,4)=S(a);
X(j,5)=T(a);
end

Risposte (1)

Pritesh Shah
Pritesh Shah il 5 Ott 2016
A(i), use can use,
for i=1:10
A(i)=...
end
  1 Commento
KANCHAN PATIL
KANCHAN PATIL il 6 Ott 2016
Thank you Sir for the answer. But I want to create three array individually containing no. of rows and might be 5-8 columns. Like X1 containing Col P, Col Q, Col R, Col S, Col T, etc and same columns for X2 array and X3 array with some different values and X1,X2 and X3 have different condition. Like X1 is the array with temperature range between 200-250 deg C, X2 is the array with temperature range between 250-300 deg C and X3 is the array with temperature range between 300-350 deg C. Could you help me with this? Regards, Patil Kanchan P., MTech-II

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by