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: Advanced colon indexing
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Kurt

Posts: 77
Registered: 12/7/04
Advanced colon indexing
Posted: May 1, 2013 5:35 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi! Consider this:

>> clear M, M(:,:,:,1,:)=rand(10,10,2,1,5); size(M)
ans =
10 10 2 1 5
>> clear M, M(:,:,:,1,:)=rand(10,10,1,1,5); size(M)
ans =
10 10 5
>> clear M, M(:,:,1,1,:)=rand(10,10,1,1,5); size(M)
ans =
10 10 1 1 5

Why doesn't the 2nd code line behave like the 1st one and the 3rd one do? (i.e. maintaining the 5-D shape of the array)

Isn't a colon allowed to represent a singleton dimension? (3rd dimension in the second code line)

Can you please pinpoint the according passage in the documentation?

Thank you!



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.