MATLAB Answers

How to save table in workspace as txt/.m file in matlab ?

48 ビュー (過去 30 日間)
Abhishek H P
Abhishek H P 2016 年 5 月 23 日
編集済み: Kirby Fears 2017 年 1 月 5 日
Table is a variable containing 99*1 double values saved in workspace. I need to convert it into txt/.m file

回答 (1 件)

Kirby Fears
Kirby Fears 2016 年 5 月 23 日
編集済み: Kirby Fears 2016 年 5 月 23 日
You can use writetable to write to a text file.
If you really need this to be a .m file, you can make a new copy as .m and delete the original file.
  2 件のコメント
Kirby Fears
Kirby Fears 2017 年 1 月 5 日
In that case, what you have is a double array instead of a table (in Matlab parlance).
You can simply use csvwrite. Here's an example.
If you want the result to be .m format, just indicate the file name accordingly:


Community Treasure Hunt

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

Start Hunting!

Translated by