How do I change the header name of csv files?

15 次查看(过去 30 天)
Here are the screenshots of my code and the ouput too
  4 个评论
dunphy
dunphy 2020-4-14
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?

请先登录,再进行评论。

采纳的回答

Adam Danz
Adam Danz 2020-4-14
编辑:Adam Danz 2020-4-15
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')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by