How to save table with data in columns instead of one long row?

20 ビュー (過去 30 日間)
Eveline Kallenberg
Eveline Kallenberg 2020 年 8 月 24 日
コメント済み: Bogdan -Ervin 2023 年 5 月 21 日
I am trying to save a table that contains several doubles and one categorical array (see picture).
When I now script (see below) I get a csv file with just one long row with all the numbers next to one another. How can I save a table with just the three columns seperate into a csv file?
writetable(table,'name.csv')

採用された回答

Eveline Kallenberg
Eveline Kallenberg 2020 年 8 月 24 日
No more help needed! I basically extracted the data inside the categorical cell array and the double cell arrays with the code below.
[mycellarray{:}]
I thereafter created three different columns (new variables) and then created a new table from the three columns and saved it into a csv file :D
column1 = [table.Var1{:}];
column2 = [table.Var2{:}];
column3 = [table.Var3{:}];
table_final = table(column1, column2, column3);
writetable(table_final,'filename.csv','writevariablenames',0); % writing the table without headers of the variable names
  1 件のコメント
Bogdan -Ervin
Bogdan -Ervin 2023 年 5 月 21 日
What to do if you want a column to contain strings?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by