Code covered by the BSD License  

Highlights from
reshape2cube

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.32 KB File ID: #24651

reshape2cube

by david s

 

07 Jul 2009 (Updated 08 Jul 2009)

Reshape a vector into a cubic array

| Watch this File

File Information
Description

Reshapes an vector with n^3 elements into an [n,n,n] array.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
07 Jul 2009 Darren Rowland

I fail to see the worth of this function.
That being said I would prefer that the 'cube' dimension be optionally given as input, so
reshape2cube(vector,m)
would transform vector with n^m elements into an m dimension array.

07 Jul 2009 Matt Fig

I am with Darren. Maybe a generalization would be more useful:

A = 1:5^2;
reshape2pow(A,2)
A = 1:5^3;
reshape2pow(A,3)
A = 1:5^4;
reshape2pow(A,4)
....

08 Jul 2009 david s

Well i found myself wanting it, and figured it might save someone else some thinking and typing as well. Thanks for the feedback

Please login to add a comment or rating.
Updates
07 Jul 2009

bug fix

08 Jul 2009

Generalised to d dimensions

08 Jul 2009

file attached this time

Tag Activity for this File
Tag Applied By Date/Time
reshape david s 07 Jul 2009 09:44:22
cube david s 07 Jul 2009 09:44:23

Contact us at files@mathworks.com