When I export results to a text file or csv etc, it is written in only one line, how do I make that it appear in columns?

2 次查看(过去 30 天)
Hello!
sigma, x, res... are all 10 dimensional vectors that I want them to appear in different columns. When I run the code everything in the txt file is in one line, separated with comas.
T=table(sigma,x,res,dist,k,p);
csvFile = 'table_data.csv';
writetable(T, csvFile);
  6 个评论
Stephen23
Stephen23 2023-12-8
编辑:Stephen23 2023-12-8
"sigma, x, res... are all 10 dimensional vectors..."
Note for the future: they have only two dimensions. And ten elements each.
ndims(0:9)
ans = 2
numel(0:9)
ans = 10

请先登录,再进行评论。

采纳的回答

Voss
Voss 2023-12-7
T=table(sigma(:),x(:),res(:),dist(:),k(:),p(:), ...
'VariableNames',{'sigma','x','res','dist','k','p'});
csvFile = 'table_data.csv';
writetable(T, csvFile);
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by