for循环中所有子图的链接轴

for循环中所有子图的链接轴

本文介绍了for循环中所有子图的链接轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难使(3,4,i)图中的所有子图都具有完全相同的轴,所有轴都从零开始.到目前为止,我的代码在下面,但是它返回所有具有不同x和y标度的子图.

I am having difficulty making all of my subplots in a (3,4,i) plots have exactly the same axes, all starting at zero. The code I have so far is below but it returns all subplots with varying x and y scales.

有人可以帮忙吗?

%% plot
for i = 1:num_bins;
    h = zeros(ceil(num_bins),1);
    h(i)=subplot(4,3,i);
    plotmatrix(current_rpm,current_torque)
end
linkaxes(h,'xy');
axis([0 30 0 8]);

推荐答案

您应将内存分配移出循环:

You should move the memory allocation outside of the loop:

%% plot
h = zeros(ceil(num_bins),1);
for i = 1:num_bins;
    h(i)=subplot(4,3,i);
    plotmatrix(current_rpm,current_torque)
end
linkaxes(h,'xy');
axis([0 30 0 8]);

这篇关于for循环中所有子图的链接轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 14:21