我想在不同的数字中可视化两组数据。以下是我现在如何实现它:
f1 = figure;
for i=0:6
plot(stim(i)+i);
hold on;
end;
f2 = figure;
for i=0:6
plot(data(i)+i);
hold on;
end;
我认为必须有结合这些循环的方法。
答案 0 :(得分:0)
不确定。根据{{3}}:首先创建空数字并执行hold-on
(每次都不需要这样做):
f1 = figure;
hold on
f2 = figure;
hold on
然后你循环:
for i=0:6
figure(f1)
plot(stim(i)+i);
figure(f2)
plot(data(i)+i);
end
这次数字已经创建;因此,在这里调用figure
会切换活动数字,以便您可以在其上进行绘图;
答案 1 :(得分:0)
没有for循环,就像这样:
idx = (0:6).';
figure(f1);
plot(stim(idx)+idx);
figure(f2);
plot(data(idx)+idx);
确保将解决方案应用于正确的维度。列向量被解释为一个数据集;对于积分,请记住设置标记。