The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Reshape
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 2 messages

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Nov 15 2012, 3:35 pm
Newsgroups: comp.soft-sys.matlab
From: "Jerry " <jerrych...@gmail.com>
Date: Thu, 15 Nov 2012 20:35:15 +0000 (UTC)
Local: Thurs, Nov 15 2012 3:35 pm
Subject: Reshape
Hello,

A=rand (201,7152);

"A" is a matrix and I would like to reshape "A" to "B"

B=reshape (A,59898,24);

"B" is not going to be what I expected since it is getting mixed up. For example

C=A(:,1:24);
D=B(1:201,:);

isequal(C, D)

ans =

0
How can I reshape "A" to get "C" equal with "D".

Thanks,
Jerry

To post a message you must first join this group.
You do not have the permission required to post.
More options Nov 15 2012, 7:43 pm
Newsgroups: comp.soft-sys.matlab
From: "Roger Stafford" <ellieandrogerxy...@mindspring.com.invalid>
Date: Fri, 16 Nov 2012 00:43:15 +0000 (UTC)
Local: Thurs, Nov 15 2012 7:43 pm
Subject: Reshape

- - - - - - - - -
To get the kind of rearrangement you have in mind takes more than a simple 'reshape'.  One has to do a little permuting first.  Do this:

r = 298; % The number of your blocks
[p,t] = size(A); % p = 201, t = 7152
q = t/r; % t must be divisible by r, q = 24
s = 0:p*q*r-1;
B = reshape(A(1+s+p*((q-1)*floor(s/p)-(q*r-1)*floor(s/(p*r)))),p*r,q);

Roger Stafford