Unable to load mat file data in Matlab App

1 visualización (últimos 30 días)
Srinivasan Ananthan
Srinivasan Ananthan el 30 de Dic. de 2020
Comentada: Srinivasan Ananthan el 31 de Dic. de 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

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 30 de Dic. de 2020
Editada: Cris LaPierre el 30 de Dic. de 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.

Más respuestas (0)

Categorías

Más información sobre Data Type Identification en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by