xlswrite: write values in different columns

4 ビュー (過去 30 日間)
pavlos
pavlos 2014 年 8 月 3 日
コメント済み: pranav kumar 2018 年 4 月 28 日
Hello,
Please help me with the following:
Consider a column vector, say "x", with dimension 1000x1.
The values of x are changing after a each iteration.
Consider for example N iterations, say "i=1:N".
How can I write the values of vector x in different column in an excel file during the iterations?
The first iteration should store the values in A1:A1000,
the second iteration should store the values in B1:B1000,
and so on.
Thank you very much.
Best,
Pavlos

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 3 日
編集済み: Azzi Abdelmalek 2014 年 8 月 3 日
You can save your data at the end of your iterations
ni=10 % number f iterations
out=zeros(1000,ni]
for k=1:ni
% calculate x
out(:,k)=x % store a column x in a matrix out
end
xlswrite('your_file.xlsx',out)
%If you want to save the value each iteration, which will take more time
w='A':'Z'
N=10
for k=1:N
range=[w(k) '1:' w(k) num2str(10)]
x=rand(10,1);
xlswrite('your_file.xlsx',x,range)
end
  1 件のコメント
pranav kumar
pranav kumar 2018 年 4 月 28 日
i have an excel sheet with 360000 values. I want to take 1000 samples at a time and compute using loop. there are 14 outputs and i want to store the 14 outputs in 14 different columns for each of 1000 samples. how can i do it.

サインインしてコメントする。

その他の回答 (1 件)

Honey  Moradi
Honey Moradi 2017 年 6 月 6 日
編集済み: Honey Moradi 2017 年 6 月 6 日
Hello, Please help me for this; I have 3 loop in my program, I want to save the result of them all in a excel sheet in different rows. for example from A1:Z1 for a loop, then from A2:Z2 and so on, for another loop with a gap like ----------- save them to next row.
for j=1:12:n
for Q=1:K
Z(j)=V(Q)
for i=j:j+10
calculate Z%
end
end
end
how can I do this???

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by