Reputation: 171
In MATLAB, I have a structure saved into matlab file:
Ch=
H:[4-D double]
D: [1x15 double]
duration:6
power: [1x1 struct]
the size of H
is
size(H) = 1332 15 4 128
save(examplefile, 'Ch','-v7.3')
Next I explain what I want to do:
Because, the file is huge, at some point of my code, I would like to load partial variables from the file examplefile
. For example, at one point I would like to load only the first 1:1332/n
of H
of the file examplefile
;, the second time I would only load the next varaiables running from 1333/n:2*1333/n
an so on and so forth....
My question is how to load the partial variables from the file created?
Looking forward for suggestions and help
Upvotes: 0
Views: 654
Reputation: 36720
You are looking for the matfile
command. Unfortunately it is very limited in indexing, indexing structs is not supported. H
must be a individual variable in the mat file.
%save using individual variables
save(examplefile,'-struct','Ch','-v7.3')
%create matfile object:
data=matfile(examplefile)
%example indexing operation. Only that part of `H` is read.
part=data.H(1:3,1,1,1)
Upvotes: 1