MATLAB: Two mat files inside one mat file

mat

I have one .mat file (eg: A) in my folder, however, when I double click it, it opens two .mat files in the workspace. I What is the data type of the actual .mat file A in the folder? Is it a struct?
Can .mat files belong to struct datatype? Please help — I am confused. Thanks a lot for your help.

Best Answer

Using load() returns a structure where all the variables inside the mat file are fields of this structure. You can extract them into their own variable if you want.
% Create mat file with two variables in the single mat file.
save(filename, 'myVar', 'otherVar');
% Show workspace panel:
workspace
% Get rid of them so we can test the recall
clear('myVar', 'otherVar');
% Recall it.
storedStructure = load(filename)
myVar = storedStructure.myVar;
otherVar = storedStructure.otherVar;
Understand now?