Saving data from a loop
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Azzi Abdelmalek
2015 年 7 月 8 日
編集済み: Azzi Abdelmalek
2015 年 7 月 8 日
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 件のコメント
Ezequiel Male
2015 年 7 月 8 日
Azzi Abdelmalek
2015 年 7 月 8 日
Post the error message
Azzi Abdelmalek
2015 年 7 月 8 日
And if possible post a sample of your data
Ezequiel Male
2015 年 7 月 8 日
Jan
2015 年 7 月 8 日
Please post the complete error message.
Ezequiel Male
2015 年 7 月 9 日
編集済み: Ezequiel Male
2015 年 7 月 9 日
Azzi Abdelmalek
2015 年 7 月 9 日
you wrote
h(:,xx)=w;
In my code it's
h(xx,:)=w;
Ezequiel Male
2015 年 7 月 14 日
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!