Extracting data from .mat file and then adding up results to form a new .mat file

Hello,
I have a query regarding data extraction. I got a .mat file with data (365rows representing days, 12columns representing hours). I would like to read these data (I did that). Concern is that for each day, I want the 12 values as columns so that I can have 365x12 rows and 2 columns.
Any help would be highly appreciated.
Thanks

 Accepted Answer

If A is your matrix, you can get one column with reshape function
B=reshape(A',[],1)
In your question, I don't know what the second column is ?

7 Comments

If you can see in the image, I got 12 values for each day in row, column form. In such a manner I have 365rows(days), and each row has 12 columns(hours).
What I want to have? I want to have a 365x12 rows, and 2 columns. The second column will have 12 values for each day. Hope you can understand now.
"If you can see in the image".... NO, we can't. Where is the image?
365*12 rows with 2 columns requires 365*12*2 = 8760 input values. But you only have 365 * 12 = 4380 input values. We do not know where the other 4380 values are to come from. Are you requesting that the inputs be duplicated so the two columns are the same?
Thanks Walter for the reply. Yes, I want that 12 values for 1 day to be repeated in column format. In that case, I would be having 4380x2 matrix. Hope I'm clear about it.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!