如何在循环中的每次迭代中保存具有不同名称的文件?软件

How can I save a file with different names on each iteration in a loop? MATLAB

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

%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

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

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