The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Question on multidimensional array
Replies: 3   Last Post: Oct 16, 2012 3:11 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Loren Shure

Posts: 1,067
Registered: 12/7/04
Re: Question on multidimensional array
Posted: Oct 16, 2012 3:11 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Paulo Guimaraes" wrote in message

"James Tursa" wrote in message <k5hn0q$184$>...
> "Paulo Guimaraes" wrote in message
> <k5hm4g$r3s$>...

> > Dear colleagues, if I have a matrix A I can apply a condition and change
> > all elements of the matrix in a single line of code. As in
> >
> > A=[0, 12, 3; 9; 3;1];
> > A(A>3)=1
> > A=[0, 1, 3; 1; 3;1];
> >
> > Is there any similar option for multidimensional arrays (e.g., each
> > element of A is now determined by n numbers in which n>2)?

> The same exact syntax for 2D matrices also works for nD arrays.
> James Tursa

>>Sorry I was not clear, I want to apply the condition just to one of the
>>dimensions, not the entire object. For example, I want to do:

>>if A(:, :, 3)>1 than A(:,:,3)=1.

A(:,:,3) = min(1,A(:,:,3));


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.