필터 지우기
필터 지우기

Extracting data from .mat file

조회 수: 1 (최근 30일)
Usman  Ali
Usman Ali 2012년 11월 28일
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