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?

조회 수: 4 (최근 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
Samuel Tárraga Habas
Samuel Tárraga Habas 2023년 12월 7일
Yessss!!! It worked, I thought I had to remove the 3 dots. Thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (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