How to save results into csv file
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuesta aceptada
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
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);
Más respuestas (0)
Ver también
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!