【发布时间】:2016-11-10 19:42:47
【问题描述】:
我想为我的算法正在执行的每个循环存储不同矩阵/向量大小的值。我的 MWE 如下:
for n1=1:T
a1=f1(n1) % Some expression which depends on n1
% a1 is just a parameter value
for n2=1:T
a2=f2(n2) % Some expression which depends on n2
% a2 is just a parameter value
while d<1
algorithm=F(a1,a2,) % my algorithm depends on these parameter values
end
% In this step I want remember the combination of parameters and store some results
v1= [a1 a2] % I store the combination of parameters used in the while loop
[A,B,C]=somefunction() % some results given inputs from the while loop
% A,B,C are matrices **of Different sizes**
v2 = [ 4x1 4x1 4x1] % I store some column vectors
% What I basically want to do is
% to remember and SEE in some MATLAB convenient form the following:
% 1. for this combination of parameters in v1
% 2. I got A B C matrices and the matrix v2
end
end
谁能帮助我如何尽可能有效地做到这一点?理想情况下,我想在每次执行 for 循环时存储所有参数值和矩阵的名称,但我不知道这在 MATLAB 中是否可行。
【问题讨论】:
-
如何将其保存为
v1=[v1;a1 a2]和v2 = [v2 ; 4*1 4*1 4*1]。 ?
标签: arrays matlab loops matrix cell