Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在 MATLAB 中将数据保存在 .txt 文件中
Matlab 有这个问题。我有一个矩阵 x,例如 x(100,10)。我只想将第六列保存在 txt 文件中,但是当我用记事本打开 txt 文件时,我希望看到列中的数字。希望可以有人帮帮我。先感谢您。
x = randi(100, 100, 10); y = x(:, 6); save('sixthcol.txt', 'y', '-ascii');
这应该可以解决问题。
谢谢安萨里。实际上,我的一位朋友向我建议了这些命令并且效果很好:
fid1=fopen('file.txt','wt'); fprintf(fid1,'%8.6f\n',x(:,6)); fclose(fid1);