How to put a vector in a file?
102 次查看(过去 30 天)
显示 更早的评论
I'd like to create a vector from 1 to 744 (vertically) and put that in a file .txt
1
2
3
..
..
744
Thanks
0 个评论
采纳的回答
Stephen23
2018-2-14
编辑:Stephen23
2018-2-14
[fid,msg] = fopen('filename.txt','wt');
assert(fid>=3,msg)
fprintf(fid,'%d\n',1:744)
fclose(fid);
Or
V = 1:744;
dlmwrite('filename.txt',V(:),'newline','pc')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!