Creating a AxBxCxD out of AxB matrix.. Using reshape, code included..little help needed

Hi
I have 137241 data in 1 column. the data is voltage of 5 households (3-phase). I want a matrix out of it showing me: 10 x 24 x days x 15
my code is:
ncust = size(x,2);
% pad data with one extra row
x = [x;zeros(1,ncust)];
% reshape data into hour/day/customer
x = reshape(x,24,[],ncust);
i tried using: reshape(x,10,24,[],ncust) but didnt work.
and the data is attached :)
i hope a kind soul will help me :)
thanks alot

6 Comments

Can you describe what the relation is between the position in the final 4D matrix (with subindices i1,i2,i3,i4) and the index J in the original vector is? For instance,
the 10th element of the vector should be in the position (1,2,3,4) of the final matrix, because ...
Hey,
Yes, AxBxCxD from an AxB matrix. the 2D matrix 9063x16 matrix ..it contains data of customers power usage during 62 days and some hours..i counted to 15 customer, the reason it shows 16 is because last customer has more data then the rest..
However i want this split into 4D matrix containing like this: min x hour x days x customer matrix.. so i can call lets say customer 10 hour 20 day 3. i will do:
x(:,20,3,10)
i have made the code partially but, it says something about division not possible...thanks
I know you likely had a 3D matrix to start with. What were those dimensions? You have a (9063x16) matrix, so we’re going to have to have more information to correctly reshape it to the dimensions you need. For instance, what was the matrix you began with, and how did you reshape it to get the matrix you have now?
It might be best to forget your current matrix, go back and start with your original 3D matrix and go from there.
BTW, voltage should be the same for all houses. Power consumption will likely differ. Also, if I remember correctly, most residential power is single-phase.
Hi Strider :D
thanks for showing interest, i will reupload the original file. itss 137241x1 matrix. if need be. however the only difference from what we have been working on, is that this is recorded each 10 min. while the old one was each 1 hour.. i am attaching the original file. i count that each customer has 9061 data. thanks again
The (137241x1) vector isn’t of much use unless we know how you reshaped it from what was obviously a 3D matrix of (minutes x days x customers).
We have many areas of brilliance between us here at MATLAB Answers, but mindreading has proven to be our collective area of absolute ineptitude.
Well not totally. I've seen Sean and Walter figure out what the poster was asking from total gobbledegook and sheer gibberish. It's my thinking that Sean has been assigned to the Mind Reading Toolbox development in the Mathworks Black Ops Skunkworks, and that perhaps Walter is a beta tester for it. Not totally out of the realm of possibility if you saw UC Berkeley Prof. Jack Gallant's plenary talk at the Electronic Imaging Symposium.

Sign in to comment.

Answers (2)

In x = [x;zeros(1,ncust)]; ncust should be an integer. ncust = size(x,2); doesn't generate an integer. Besides, I'm not sure if your code is the way to go. In reshape you have to determine what arrays of your 137241 x 1 matrix should be located in the output row and which ones should be located in the columns. Just my two cents.

Categories

Tags

No tags entered yet.

Asked:

on 3 May 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!