在Matlab中绘制多维数组 [英] Plot multidimensional array in Matlab
本文介绍了在Matlab中绘制多维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个矩阵,例如:
size P = zeros(2,2,100);
让我们尝试绘制每个矩阵的第一个元素,如下所示:
Let's try to plot the first element of each of these matrices, like this:
plot(1:1:100, P(1,1,:))
这不起作用.正确的方法是什么?
This does not work. What is the proper way to do it?
推荐答案
尝试绘图(squeeze(P(1,1,:)).
Try plot(squeeze(P(1,1,:)).
squeeze()函数删除单例尺寸(尺寸为1的尺寸).
The squeeze() function removes singleton dimensions (dimensions whose size are 1).
这篇关于在Matlab中绘制多维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文