Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How MATLAB interprets multi-dimensional arrays?

Subject: How MATLAB interprets multi-dimensional arrays?

From: Eric Diaz

Date: 16 Aug, 2011 16:53:10

Message: 1 of 4

Dear MATLAB community,

I am running into some difficulty controlling how MATLAB interprets multi-dimensional arrays.

For example,
figure;plot(data(1,1,1,:))
??? Error using ==> plot
Data may not have more than 2 dimensions

I was under the impression that I was calling a single dimension of the 4D data variable by writing data(1,1,1,:). However, it seems that MATLAB is interpreting this as
data(1,1,1,:) =
ans(:,:,1,1),
ans(:,:,1,2),
ans(:,:,1,3),
etc...

How can I specify that I want the entire column vector of the 4D array defined by data(1,1,1,:) ?

Thank you,

Eric

Subject: How MATLAB interprets multi-dimensional arrays?

From: James Tursa

Date: 16 Aug, 2011 17:17:32

Message: 2 of 4

"Eric Diaz" wrote in message <j2e79m$qp4$1@newscl01ah.mathworks.com>...
> Dear MATLAB community,
>
> I am running into some difficulty controlling how MATLAB interprets multi-dimensional arrays.
>
> For example,
> figure;plot(data(1,1,1,:))
> ??? Error using ==> plot
> Data may not have more than 2 dimensions
>
> I was under the impression that I was calling a single dimension of the 4D data variable by writing data(1,1,1,:). However, it seems that MATLAB is interpreting this as
> data(1,1,1,:) =
> ans(:,:,1,1),
> ans(:,:,1,2),
> ans(:,:,1,3),
> etc...
>
> How can I specify that I want the entire column vector of the 4D array defined by data(1,1,1,:) ?
>
> Thank you,
>
> Eric

squeeze(data(1,1,1,:))

James Tursa

Subject: How MATLAB interprets multi-dimensional arrays?

From: Matt J

Date: 16 Aug, 2011 17:20:28

Message: 3 of 4

"Eric Diaz" wrote in message <j2e79m$qp4$1@newscl01ah.mathworks.com>...
>
> How can I specify that I want the entire column vector of the 4D array defined by data(1,1,1,:) ?
=============

plot(squeeze(data(1,1,1,:)))

Subject: How MATLAB interprets multi-dimensional arrays?

From: Eric Diaz

Date: 16 Aug, 2011 17:29:28

Message: 4 of 4

"Matt J" wrote in message <j2e8ss$36j$1@newscl01ah.mathworks.com>...
> "Eric Diaz" wrote in message <j2e79m$qp4$1@newscl01ah.mathworks.com>...
> >
> > How can I specify that I want the entire column vector of the 4D array defined by data(1,1,1,:) ?
> =============
>
> plot(squeeze(data(1,1,1,:)))

Thank you very much.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us