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 Ansichten (letzte 30 Tage)
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 Kommentare
Stephen23
Stephen23 am 8 Dez. 2023
Bearbeitet: Stephen23 am 8 Dez. 2023
"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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Voss
Voss am 7 Dez. 2023
T=table(sigma(:),x(:),res(:),dist(:),k(:),p(:), ...
'VariableNames',{'sigma','x','res','dist','k','p'});
csvFile = 'table_data.csv';
writetable(T, csvFile);
  4 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by