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.
我有一个这样的数字字符串数据列:
0004000 0000000 0000001 .....
%s但是当我使用格式将它们导出到 csv 文件中时fprintf,列更改为:
%s
fprintf
4000 0 1 ......
我的代码一般是这样的:
a=num2str(A,'%07d'); ... fprintf(f,'%s\n',a); ...
这对我有用,不需要中间步骤num2str,而是直接使用fprintf:
num2str
A=[4000;0;1] f = fopen('foo.txt','w') fprintf(f,'%07d\n',A); fclose(f)