user2724407
user2724407

Reputation: 99

how can I load a part of .mat file in matlab

I've a mat file with 24 variables inside and I would like to load only the 100 first value of the variables named Var1 and Var2 in the mat file.

Upvotes: 3

Views: 848

Answers (3)

am304
am304

Reputation: 13886

This utility on the File Exchange looks like it may do the job.

Upvotes: 1

Fraukje
Fraukje

Reputation: 683

In previous versions this is unfortunately not possible, see here

Best option would thus be to load in all variables and then create new variables containing only the first 100 values.

Upvotes: 0

beginner
beginner

Reputation: 61

Have a look at the matfile function (should be available from 2011b on). The documentation explains it pretty well.

obj = matfile('test.mat')
% save a variable
obj.foo = magic(30);
% load a variable
obj.foo(5:10,3:4)

Upvotes: 2

Related Questions