我有一个循环计算多个条件下的均值(
这是我尝试过的代码:
注意:
有人能帮忙吗?
m
)、标准差(std
)和标准误差(sem
)。由于每个条件都有自己的m
、std
和sem
,我想要相应地对输出进行命名(它们应该是双精度格式)。例如:cond1_m
、cond1_std
、cond1_sem
、cond2_m
、cond2_std
、cond2_sem
等。这是我尝试过的代码:
cond={'cond1','cond2','cond3','cond4','cond5',...}
for a=1:length(cond)
[strcat(cond{a},'_m'),strcat(cond{a},'_std'),strcat(cond{a},'_sem')]=compute_stats(M(:,a));
end
注意:
compute_stats
是输出 m
、std
和 sem
的函数。 M
是包含我的数据的矩阵。问题在于,strcat
似乎不能作为更改输出名称的方法。例如,在第一次迭代中,我的输出应该是 cond1_m
,但实际上我的输出是一个名为 strcat 的矩阵。有人能帮忙吗?
eval
(http://stackoverflow.com/questions/32467029/how-to-put-these-images-together)。我建议使用具有动态字段名称的结构体,语法为`condstruc.([num2str(a), '_m'])`等。 - Andras Deak -- Слава Україні