How I save my variable into text file?
21 ビュー (過去 30 日間)
古いコメントを表示
I have a problem during saving my variable. When I run my code I receive a value (249336x4 int16). If I open it in MATLAB I see all the numbers and everything is good. Then I use the command: save('result.txt','result'); But in the .txt file when I open I dont get the same numbers but some text which is not understandable. I also tried to save like this: save('result.txt', 'result', '-ASCII'); But I receive a message: "Warning: Attempt to write an unsupported data type to an ASCII file. Variable 'result' not written to file. " I dont understand what is the problem. Any one can help me? Thanks in advance!
0 件のコメント
採用された回答
V K
2016 年 10 月 29 日
I would not recommend using "save" for saving variables as text files.
For starters, try csvwrite or dlmwrite. For example, to write-out the variable "result" to a comma separated text file, use csvwrite('test_output.csv',result)
If you instead want to try writing strings and numbers together, look up "fprintf".
Good luck!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!