How to save results into csv file

1 visualización (últimos 30 días)
Nivodi
Nivodi el 22 de Jul. de 2018
Comentada: Nivodi el 23 de Jul. de 2018
Hello everyone, I have a csv file (9X15). At the 15th column, I have times and I converted them in seconds. How can I add/save these results (from the command window)into a new column (16th) at the same csv file.? Thank you very much

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Jul. de 2018
Stitch the column onto the right side, and then call csvwrite():
m16Cols = [m15Cols, column16]; % Stitch column16 onto existing 15 column matrix.
csvwrite(filename, m16Cols);
  3 comentarios
Image Analyst
Image Analyst el 22 de Jul. de 2018
You didn't say they were tables before. Try using join() or outerjoin(), but it should work as is. Then use writetable() instead of csvwrite().
What are the data types of m15Cols and column16? They should both be tables. Evidently one of them is NOT a table - it's probably a regular double vector or something. Here is a demo:
load patients % Load built-in demo data.
T4 = table(Age,Height,Weight,Systolic, ...
'RowNames',LastName)
T1 = table(Diastolic)
Tboth = [T4, T1]
writetable(Tboth, filename);
Nivodi
Nivodi el 23 de Jul. de 2018
Thank you very much for your help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by