Unable to load mat file data in Matlab App

조회 수: 4 (최근 30일)
Srinivasan Ananthan
Srinivasan Ananthan 2020년 12월 30일
댓글: Srinivasan Ananthan 2020년 12월 31일
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

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 12월 30일
편집: Cris LaPierre 2020년 12월 30일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by