简体   繁体   中英

Plotting from 3D matrix in Matlab

I have a matrix which is 1*1*10000, the slightly odd dimensions are the result of the matrix algebra used to calculate it.

I simply want to be able to plot the 10000 data points contained in it, but matlab seems unable to do it?

Can someone please tell me how I can plot the data?

Seems simple but I really can't figure out how to do it!

Baz

yes you need to reduce the dimensions to a vector:

A = zeros(1,1,100)
vector = squeeze(A(1,1,:))

as when you'd access the third dimension this would only return a 3D-Matrix again:

z = A(1,1,:)

would NOT work. So use squeeze() ;-) Then plot as usual.

Doc-Link: http://www.mathworks.de/de/help/matlab/ref/squeeze.html And as Ander pointed out in comments, no need to give any dimensions, as it removes singleton-dimensions by itself. So just use vector = squeeze(A) . MATLAB recognizes the way to go itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM