Effacer les filtres
Effacer les filtres

How do I change the header name of csv files?

16 vues (au cours des 30 derniers jours)
dunphy
dunphy le 14 Avr 2020
Commenté : Adam Danz le 15 Avr 2020
Here are the screenshots of my code and the ouput too
  4 commentaires
dunphy
dunphy le 14 Avr 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 le 14 Avr 2020
I'm using R2019b

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 14 Avr 2020
Modifié(e) : Adam Danz le 15 Avr 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 commentaires
dunphy
dunphy le 15 Avr 2020
It worked, ty so much!
Adam Danz
Adam Danz le 15 Avr 2020
Glad I could help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by