Writing into excel sheet from matlab

I would like to write a matrix (1xn ) generated during each iteration of for loop into an excel sheet. during the first iteration the matrix should be entered into row 1, second iteration should update row2 and so on... using writematrix function in matlab. Please help me with a solution.

2 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 10 月 11 日
Store the values in an array and use writematrix.
What seems to be the problem?
RENJI
RENJI 2023 年 10 月 11 日
Got it now...Thank you very much for your response.

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

回答 (2 件)

Binaya
Binaya 2023 年 10 月 11 日

0 投票

Hi
You can directly use "writematrix" or use convert the matrix into a table and use "writetable" functions to write into an excel sheet.
Regards
Binaya
KSSV
KSSV 2023 年 10 月 11 日

0 投票

N = 10 ;
iwant = zeros(N,1) ;
for i = 1:N
iwant(i) = i ;
end
T = table(iwant) ;
writetable(T,'Test.xlsx')

1 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 10 月 11 日
Why convert to a table when one can directly save the array via readmatrix?

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

タグ

質問済み:

2023 年 10 月 11 日

コメント済み:

2023 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by