Solution to "MatFile objects must be scalar. Try assigning the object to a scalar variable."?

I have quite a few .mat files that I used to load them. But it uses too much memory. I tried to use matfile instead of load but I couldn't.
for i = 1:numel(files)
I2(i) = matfile(['saved_images/2/read/', files(i).name]);
end
It gives me this error:
MatFile objects must be scalar. Try assigning the object to a scalar variable.
I have to use them as an array. I can't use a MatFile variable for each .mat file. What is the best way to solve this problem?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!