matlab将二维数组写入txt文件
%用matlab将二维数组写入txt文件 %比方说 矩阵A 为 A=[1 2 3;4 5 6]; %那么程序 为 fid=fopen("A1.txt","w"); [b1 b2]=size(A); for i=1:b1 for j=1:b2 fprintf(fid,"%10d",A(i,j)); end fprintf(fid," "); end fclose(fid);
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。