【问题标题】:How can I save a file with different names on each iteration in a loop? MATLAB如何在循环中的每次迭代中保存具有不同名称的文件? MATLAB
【发布时间】:2015-10-04 20:02:02
【问题描述】:

我有一个文件,在循环中的每次迭代中都会更改名称,我想在每次迭代中使用他在此迭代中的名称保存它。这是可能的?我该怎么做?

%matrixImages is a 3D matrix that on each iteration has different values
for i=1:N    
      cmd = ['images' num2str(i) '= matrixImages;'];
      eval(cmd); %now in images1 is the content of matrixImages
      save %i want to save images1 with the name images1,images2 with the name images2...
end

【问题讨论】:

    标签: matlab loops save eval


    【解决方案1】:

    我找到了解决方案,使用命令 eval

     cmd = ['images' num2str(i) '= matrixImages;'];
     eval(cmd);
     eval(['save images' num2str(i) 'images' num2str(i) ';']);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-01
      • 2018-02-13
      • 1970-01-01
      • 1970-01-01
      • 2013-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多