Filter löschen
Filter löschen

How do I change the header name of csv files?

16 Ansichten (letzte 30 Tage)
dunphy
dunphy am 14 Apr. 2020
Kommentiert: Adam Danz am 15 Apr. 2020
Here are the screenshots of my code and the ouput too
  4 Kommentare
dunphy
dunphy am 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?
dunphy
dunphy am 14 Apr. 2020
I'm using R2019b

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Adam Danz
Adam Danz am 14 Apr. 2020
Bearbeitet: Adam Danz am 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')
  2 Kommentare
dunphy
dunphy am 15 Apr. 2020
It worked, ty so much!
Adam Danz
Adam Danz am 15 Apr. 2020
Glad I could help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by