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 vues (au cours des 30 derniers jours)
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 commentaires
Stephen23
Stephen23 le 8 Déc 2023
Modifié(e) : Stephen23 le 8 Déc 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

Connectez-vous pour commenter.

Réponse acceptée

Voss
Voss le 7 Déc 2023
T=table(sigma(:),x(:),res(:),dist(:),k(:),p(:), ...
'VariableNames',{'sigma','x','res','dist','k','p'});
csvFile = 'table_data.csv';
writetable(T, csvFile);
  4 commentaires
Samuel Tárraga Habas
Samuel Tárraga Habas le 7 Déc 2023
Yessss!!! It worked, I thought I had to remove the 3 dots. Thank you very much.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by