Search code examples
matlabmat-file

How can I load part of a .mat file that is too big in memory for my machine?


I have a big .mat file that I want to process, but it is too big to fit in a single load. I thought to load it in parts, each time to access just the important parameters. So I have practically two questions:

  1. How can I access the variables names of the mat file without loading it?
  2. How can I load only one of them to the workspace?

Thanks!


Solution

  • you can see the list of variables using:

    vars = whos('-file','name.mat');
    

    and then just load the variable you want, say the first one on the list, by:

    load('name.mat', vars(1).name)