How can i save an array in a txt file, with every number of the array in a different row?
3 次查看(过去 30 天)
显示 更早的评论
I have an array with a lot of numbers, and i need to export it in a .txt file, but every number needs to be in a different row
0 个评论
回答(1 个)
Voss
2023-7-31
Something like this?
% a matrix
M = magic(4)
% write to file, using (:) to convert to column vector first
writematrix(M(:),'test.txt')
% check the contents of the file
type test.txt
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!