Two mat files inside one mat file

2 vues (au cours des 30 derniers jours)
Nalini Nadupalli
Nalini Nadupalli le 26 Oct 2015
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.

Réponse acceptée

Image Analyst
Image Analyst le 26 Oct 2015
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?
  1 commentaire
Nalini Nadupalli
Nalini Nadupalli le 26 Oct 2015
Yes I understand. Thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by