Extract specific table columns of table variable from a .mat file

17 ビュー (過去 30 日間)
Malik
Malik 2022 年 2 月 16 日
コメント済み: Malik 2022 年 2 月 22 日
Hello there, Support would be very much apprecaited with the following:
Background: I have append a large number of .mat files that contain tables. These files are very large and I would like to load only specific table columns e.g. a, d, f of the 96 columns, without opening the entire file, to reduce the memory hit. Each .mat file has the same variable 'data_unstacked', of different time periods, that I would later like to append. So,
  • I have a filename.mat file that contains a table unstacked_data
  • table data_unstacked has a number of colums with 96 variable names a, b, c and so on...
  • when I load('filename.mat'), it reveals a 1x1 struct in my workspace that on opening contains the data_unstacked 1123456x96 table
  • I would like to only load columns Timestamp, a, d, f etc. of table data_unstacked when I load the file
  • Later, once I have loaded, say, twelve of these mat files I would like to append the downselected tables, since they are part of the same timeseries.
Inside the .mat file:
Many thanks!

採用された回答

Malik
Malik 2022 年 2 月 20 日
編集済み: Malik 2022 年 2 月 20 日
I have found a similar request from user in the past. See:
It seems my request, which is very similar to above, is a Matlab limitation.
Would be great if someone could confirm, or provide a workaround.
Thank you!
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 2 月 21 日
As @Steven Lord pointed out there, it is a documented limitation https://www.mathworks.com/help/matlab/ref/matlab.io.matfile.html#mw_cd9f9130-9398-4df9-9729-070d19d4c781 that matfile cannot index into variables of tables. Indexing in this case includes fetching the whole variable.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 2 月 16 日
編集済み: Walter Roberson 2022 年 2 月 20 日
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 2 月 20 日
I guess because the table has the header information about variable types and descriptions and so on, that this is just something that is not possible at this time.
Malik
Malik 2022 年 2 月 22 日
Thank you for your response.

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

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by