Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Simple 2D to 3D conversion
Replies: 2   Last Post: Jan 11, 2013 2:08 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,868
Registered: 12/7/04
Re: Simple 2D to 3D conversion
Posted: Jan 10, 2013 10:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Ryan " <rjpatton314@gmail.com> wrote in message <kcnvmn$jfi$1@newscl01ah.mathworks.com>...
> Given
> M = [1 2 ; 3 4 ; 5 6 ; 7 8 ; 9 10 ; 11 12 ; 13 14 ; 15 16]
>
> M =
>
> 1 2
> 3 4
> 5 6
> 7 8
> 9 10
> 11 12
> 13 14
> 15 16
>
> Generate a 3D array A without loops:
>
> A(:,:,1) =
>
> 1 2
> 3 4
> 5 6
> 7 8
>
>
> A(:,:,2) =
>
> 9 10
> 11 12
> 13 14
> 15 16

- - - - - - - - - - -
A = permute(reshape(M.',2,4,2),[2,1]);

Roger Stafford



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.