applying timerange to a number of .mat files containing timetables

2 ビュー (過去 30 日間)
minomi
minomi 2018 年 4 月 10 日
コメント済み: minomi 2018 年 7 月 3 日
I have a series of .mat files containing timetables that I have created by creating a table fist and then converting that to timetables using table2timetable. I then save the timetables in a location.
I then want to be able to create a datastore for the folder with all the timetables (.mat files), then create tall arrays, and then convert the tall array to timetables so that I can apply the timerange function to select data from all the files in the folder corresponding to the start and end time of the timerange.
Every method that I try has an issue somewhere along the steps described above. Either I am not able to use timerange with .mat files, or writetable does not create timetables, etc ...
  2 件のコメント
Hatem Helal
Hatem Helal 2018 年 4 月 12 日
How are you importing the data into matlab? Are you using datastore or readtable or something else? I think you might be able to bypass writing an intermediate copy of the data but some additional details would be helpful.
minomi
minomi 2018 年 5 月 2 日
I'm using datastore.

サインインしてコメントする。

回答 (1 件)

Anandan Rangasamy
Anandan Rangasamy 2018 年 4 月 11 日
編集済み: Anandan Rangasamy 2018 年 4 月 11 日
I think the right way to do this is to begin with tall timetables first, that way you don't mess up the way timetables are formatted differently from different .mat files.
Did you try to create tall timetables and call write on the tall timetable you have? I think this will help you streamline your workflow. Here is the documentation for tall/write: tall/write
Note that you can create tall timetables from in-memory timetables, as well:
>> MeasurementTime = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'});
>> Temp = [37.3;39.1;42.3];
>> Pressure = [30.1;30.03;29.9];
>> WindSpeed = [13.4;6.5;7.3];
>> TT = timetable(MeasurementTime,Temp,Pressure,WindSpeed);
>> TT = retime(TT,'hourly','linear');
>> tallTT = tall(TT)
>> write('./myTimeTables', tallTT);
Later on, you can recreate the same tall timetable from the snapshot:
>> recreatedTallTT = tall(datastore('./myTimeTables'))
  1 件のコメント
minomi
minomi 2018 年 7 月 3 日
thanks and sorry for the late reply. I think one main issue I have is that using "write" or "writetable" seems to be very slow but in order to use "timerange" I would need to save the tables in ".txt" and hence I need to use the "write" functions as oppose to saving timetables as ".mat files.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by