Azzera filtri
Azzera filtri

How do I change the header name of csv files?

16 visualizzazioni (ultimi 30 giorni)
Here are the screenshots of my code and the ouput too
  4 Commenti
dunphy
dunphy il 14 Apr 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?

Accedi per commentare.

Risposta accettata

Adam Danz
Adam Danz il 14 Apr 2020
Modificato: Adam Danz il 15 Apr 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')

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by