Unable to load mat file data in Matlab App

1 Ansicht (letzte 30 Tage)
Srinivasan Ananthan
Srinivasan Ananthan am 30 Dez. 2020
In the App , I would like to ask the user to select the mat file path and load that file into workspace by pressing a push button. Below is the code and I don't why the mat file data is not getting loaded into the workspace. Secondly I also would like to plot the data in additional tabs. Could somebody help?
% Button pushed function: LoadButton_2
function LoadButton_2Pushed(app, event)
[app.file,app.path] = uigetfile('*.mat');
if isequal(app.file,0)
disp('User selected Cancel');
else
tempX =load(fullfile(app.path,app.file));
app.plotdata_2 =tempX;
disp(['User selected ', fullfile(app.path,app.file)]);
app.Logfile_2EditField.Value = app.file;
end
end

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 30 Dez. 2020
Bearbeitet: Cris LaPierre am 30 Dez. 2020
The variables in your mat file are getting loaded into a structure. You have named this structure tempX. In order to access the data, you need to use the structure name and the variable name:
data = tempX.varName;
You can read more about this syntax with load here.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by