Ocean Blue
Ocean Blue

Reputation: 33

Read specific column from .mat file in matlab

I want to load specific column form .mat file already exist in the work space after I load it how should I write then ?

Upvotes: 1

Views: 8884

Answers (1)

yuk
yuk

Reputation: 19880

You can access part of a variable saved in a MAT file using MATFILE constructor (available since R2011b). Check my answer to another similar question.

For example, if you have matrix a saved in matlab.mat file you constract the matfile object as

matObj = matfile('matlab.mat');

Then you can access 2nd column like x = matObj.a(:,2);.

Upvotes: 3

Related Questions