Borrar filtros
Borrar filtros

How do I change the header name of csv files?

16 visualizaciones (últimos 30 días)
dunphy
dunphy el 14 de Abr. de 2020
Comentada: Adam Danz el 15 de Abr. de 2020
Here are the screenshots of my code and the ouput too
  4 comentarios
dunphy
dunphy el 14 de Abr. de 2020
That is my full code. When i run it, there will always be a speed.csv file forming however the headings remain "Var1" "Var 2". How do I change it permanently?
dunphy
dunphy el 14 de Abr. de 2020
I'm using R2019b

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 14 de Abr. de 2020
Editada: Adam Danz el 15 de Abr. de 2020
When you write the csv file, there are no headers using the syntax you shared. The Var1 Var2.... headers appear when you read the data back into Matlab.
I suggest you convert your matrix into a table and use writetable() instead of csvwrite.
T = array2table([p(:),d(:),e(:)], 'VariableNames', {'p','d','e'})
% Replace these with meaningful variable names ^^^^^^^^^^^^^
writetable(T, 'speed.csv')
  2 comentarios
dunphy
dunphy el 15 de Abr. de 2020
It worked, ty so much!
Adam Danz
Adam Danz el 15 de Abr. de 2020
Glad I could help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by