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

2 views (last 30 days)
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 Comment
Geoff Hayes
Geoff Hayes on 30 Jun 2022
@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?

Sign in to comment.

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!