Saving data from a loop
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
Goodday everyone,
I am a newbie in using matlab software and I find it difficult on storing an answer from a loop in a designated variable. I was planning to store the roots of an equation by which the constant variables of the 6th degree polynomial was imported from excel file. I was planning to store the values in columns of the "h" variable. Hope you can help me regarding this matter. The matlab code that i created is shown below.
Thank you very much!
data=xlsread('Soil Characterization.xlsx',5,'C17:K23');
L=length(data(1,:));
x=1;
for xx=1:L+1;
if (xx<L+1);
a = data (1, xx);
b = data (2, xx);
c = data (3, xx);
d = data (4, xx);
e = data (5, xx);
f = data (6, xx);
g = data (7, xx)-10;
y=[a b c d e f g];
w=roots(y);
end
h(x,:)=w;
x=x+1;
end
Respuestas (1)
Azzi Abdelmalek
el 8 de Jul. de 2015
Editada: Azzi Abdelmalek
el 8 de Jul. de 2015
data=xlsread('Soil Characterization.xlsx',5,'C17:K23');
L=length(data(1,:));
h=zeros(L,6)
for xx=1:L;
y=[data(1:6,xx)' data (7, xx)-10 ];
w=roots(y);
h(xx,:)=w';
end
8 comentarios
Ezequiel Male
el 8 de Jul. de 2015
Azzi Abdelmalek
el 8 de Jul. de 2015
Post the error message
Azzi Abdelmalek
el 8 de Jul. de 2015
And if possible post a sample of your data
Ezequiel Male
el 8 de Jul. de 2015
Jan
el 8 de Jul. de 2015
Please post the complete error message.
Ezequiel Male
el 9 de Jul. de 2015
Editada: Ezequiel Male
el 9 de Jul. de 2015
Azzi Abdelmalek
el 9 de Jul. de 2015
you wrote
h(:,xx)=w;
In my code it's
h(xx,:)=w;
Ezequiel Male
el 14 de Jul. de 2015
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!