フィルターのクリア

How to access a particular array from a structure of arrays saved in a .mat file without loading the entire mat file

6 ビュー (過去 30 日間)
Hi
I have a .mat file which contain a structure which in turn has many fields and large data arrays. Sample file shown below:
y_struct = struct('yval',[],'time',[]);
y_struct.yval = struct('tag',{'y1value','y2value','y3value'},'data',{[],[],[]}); % Defining structure to store the y array
% and its deviations
y_struct.time = t;
y_struct.yval(1).data = input;
y_struct.yval(2).data = y_struct.yval(1).data + 0.5;
Load command will save the entire mat file in memory. In my application, I want to access data fields with a particular tag(y_struct.yval(1).data). Is there a way to directly access this array element without having to load the entire .mat file? I read that using a matfile object we can access mat file elements but is it possible to access array index?

採用された回答

KSSV
KSSV 2016 年 10 月 5 日
編集済み: Walter Roberson 2016 年 10 月 5 日
  3 件のコメント
Nadia A
Nadia A 2016 年 10 月 10 日
編集済み: Nadia A 2016 年 10 月 10 日
It says field cannot be accessed. The mat file contains 3 (1x4) structures. tag1,tag2,tag3(each of dimension 1x4). When I try to access data field of tag1, it shows error
'Cannot index into 'tag1' because MatFile objects only support '()' indexing'

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by