could pass UIAxes= matlab.ui.control.UIAxes 's to its member's class instance?

조회 수: 1 (최근 30일)
audo King
audo King 2022년 6월 30일
댓글: Geoff Hayes 2022년 6월 30일
Hi,
I'm using app design to generate ui code and modified to add my class like this:
it will report that cannot call script clearpoints as function .
classdef ds_scopeplot < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
DataScopeUIFigure matlab.ui.Figure
uartcontrol_panel matlab.ui.container.Panel
PlotButton matlab.ui.control.Button
Switch matlab.ui.control.Switch
SwitchLabel matlab.ui.control.Label
AvailablePortDropDown matlab.ui.control.DropDown
AvailablePortDropDownLabel matlab.ui.control.Label
GridONCheckBox matlab.ui.control.CheckBox
channelselectionEditField matlab.ui.control.EditField
channelselectionEditFieldLabel matlab.ui.control.Label
dataplot_panel matlab.ui.container.Panel
UIAxes matlab.ui.control.UIAxes
Serial_Port_Instance;
end
% Callbacks that handle component events
methods (Access = private)
% Callback function
function ConnectButtonSizeChanged(app, event)
position = app.ConnectButton.Position;
end
function TargetSelectorValueChanged(app, event)
ab = app.AvailablePortDropDown.Value;
app.m_Port_Instance = [];
app.m_Port_Instance = serial_port_user_def(ab,230400);
end
function plot_serial_com_data(app)
app.m_Port_Instance.set_channel_status(0,app.UIAxes);% <--- here will report error about call...
% clearpoints() for cannot call script clearpoints as function.
end
end
end
class serial_port_user_def < handle
%varargin{1} value to check if need clear lines;
%varargin{2} app.UIaxis;
function set_channel_status(sIns,varargin)
if 1 == varargin{1}
sIns.m_plot_handles(size(sIns.m_number_of_opened_channel,2))= animatedline(varargin{2});% expect it works like animatedline(app.UIaxis);
else
%delete this channel data line
if ishandle(sIns.m_plot_handles(openedid))
clearpoints(sIns.m_plot_handles(openedid));
sIns.m_plot_handles(openedid) = [];
%drawnow;
end
end
end
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2022년 6월 30일
@audo King - what is clearpoints? Is this a function that you have created? Why do you pass sIns.m_plot_handles in one call but no parameters in the other call?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by