matlab如何输出矩阵到txt并指定数的精度 (2013-11-20 16:50:43)转载▼ 标签: matlab 输出数据 假设你的数据矩阵为a; [m n] = size(a); [filename pathname] = uiputfile{'*.txt','Select Save file'); if ~filename return; else str = [pathname filename]; fin = fopen(str,'wt'); for i = 1:m for j =1:n fprintf(fin,'.3f\t',a(i,j)); %指定输出格式和小数点后有效位数 end fprintf(fin,'\n'); end fclose(fin); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MATLAB初学者必读 clear,clc a = rand(12000,1004); fid = fopen('2.txt','w'); fprintf(fid,['%f %f %f %f ' repmat('%f',1,1000) '\r\n'],a'); fclose(fid);

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2021-12-02
  • 2021-11-23
  • 2022-01-22
  • 2022-12-23
猜你喜欢
  • 2021-05-28
  • 2021-11-30
  • 2022-12-23
  • 2021-10-24
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案