Writing into excel sheet from matlab

2 visualizaciones (últimos 30 días)
RENJI
RENJI el 11 de Oct. de 2023
Comentada: Dyuman Joshi el 11 de Oct. de 2023
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 comentarios
Dyuman Joshi
Dyuman Joshi el 11 de Oct. de 2023
Store the values in an array and use writematrix.
What seems to be the problem?
RENJI
RENJI el 11 de Oct. de 2023
Got it now...Thank you very much for your response.

Iniciar sesión para comentar.

Respuestas (2)

Binaya
Binaya el 11 de Oct. de 2023
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 el 11 de Oct. de 2023
N = 10 ;
iwant = zeros(N,1) ;
for i = 1:N
iwant(i) = i ;
end
T = table(iwant) ;
writetable(T,'Test.xlsx')
  1 comentario
Dyuman Joshi
Dyuman Joshi el 11 de Oct. de 2023
Why convert to a table when one can directly save the array via readmatrix?

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by