필터 지우기
필터 지우기

How to use uigetfile to plot the contents of a file?

조회 수: 2 (최근 30일)
farzad
farzad 2020년 3월 26일
댓글: Peng Li 2020년 3월 26일
Hi all
how can I use the uigetfile to chose a file and plot its contents
I defined the public property for the push button and I have also a check box that in case it's checked , the plot should be held to be compared with the next one to be plotted
so the property :
properties (Access = public)
selecplot=''%Path for plots
end
then in the pushbutton for plot :
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
switch app.HoldPlotsCheckBox.Value
case 0
app.selectplot= uigetfile();
drawnow;
% FocusUIFigure(app.UIFigure)
app.UIFigure.Visible = 'off';
app.UIFigure.Visible = 'on';
end
end
% Value changed function: HoldPlotsCheckBox
function HoldPlotsCheckBoxValueChanged(app, event)
value = app.HoldPlotsCheckBox.Value;
end
with the above I get the error :
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.
Unrecognized property 'selectplot' for class 'app'.
Error in app120/PlotButtonPushed (line 1969)
app.selectplot= uigetfile();
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.

채택된 답변

Peng Li
Peng Li 2020년 3월 26일
your property block shows that your property name is selecplot while when you use it, you used selectplot.
  댓글 수: 2
farzad
farzad 2020년 3월 26일
thank you Peng, despite correcting that, I still get the same error even for the corrected name. thank you still for noticing, do you think I should define more parameters ? what is missing ?
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.
Unrecognized property 'selectplot' for class 'app'.
Error in app/PlotButtonPushed (line 1969)
app.selectplot= uigetfile();
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.
Peng Li
Peng Li 2020년 3월 26일
maybe you should try close it and rerun it. the old class is shadowing your changed one i think if you just correct the code while still trying on the previous instance.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by