Extracting data from .mat file

3 次查看(过去 30 天)
Hi everyone, I have received a *.mat file from my supervisor that contains 4 tables. every table is constructed on hourly based data from a power generator, 24 hours a day and 365 days a year. so it (24*365)= 8760x1 table. that the properties of the table ''Time vector characteristics
Length 8760
Start date 01-Jan-2006 01:00:00
End date 01-Jan-2007 00:00:00
''
I need to extract data from the table in such form that I re-arrange it into 365x24 matrix so that every row show data for 1 day with 24 hours.

采纳的回答

Mitch Martelli
Mitch Martelli 2012-11-28
Sorry i dont understand well your question
to extract the data you can try to use getEntry, documentation are reported in the link below :
Moreover if i understand well your aim reshape(xxx,365,24) dont give you what you want.
B = reshape(xxx,24,365);
B=B';
  1 个评论
Usman  Ali
Usman Ali 2012-12-6
Actually I had a time series data with time stamp and data in the array that's why reshape is not working. NOw I extracted the data and time seperately from the file and save to another variable. and then applied the reshape, it works now.

请先登录,再进行评论。

更多回答(2 个)

Mitch Martelli
Mitch Martelli 2012-11-28
Hi, You can use the reshape function.
Example :
data=rand(8760,1)
B = reshape(data,24,365);
B=B';
Regards
M1tC4

Image Analyst
Image Analyst 2012-11-28
What is stored in the mat file? Is it a structure with a cell array with 4 cells, and inside each cell is another cell array that is the table? So basically in other words there are 4 tables. And each table is an (N rows) by (3 columns) cell array where each of those cells contains a string? Because that's what you're showing. Can you do this and tell us what shows up in the command window:
storedStructure = load(yourMatFileName);
whos storedStructure
storedStructure
  1 个评论
Usman  Ali
Usman Ali 2012-11-28
Sorry I am newbie to matlab so not clear about structures etc. the .mat file contains 4 arrays (tables). if I check the size of each array it show (8760x1), but when i double click on the table, shows format like times series. u can see that in attached picture. https://www.dropbox.com/s/7dllq5alm0zuffr/test.jpg
I would like to extract data from last table zr513..
I tried it with reshape(zr513,365,24); but it give this error, 'To RESHAPE the number of elements must not change'

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by