Undefined function 'updateSystem' for input arguments of type 'matlab.ui.Figure'.
2 views (last 30 days)
Show older comments
niranjan nuthalapati
on 19 Nov 2019
Commented: niranjan nuthalapati
on 19 Nov 2019
Line 1: h = filterPlot(trip,0,18,1,2000,machMap,20,110);
Line2: updateSystem(h,filterPlot(trip,0,18,1,2000,machMap,25,110));
I am using above two lines of code to update my figure with new inputs. and I get the above error.
First line gives me a figure using my filterPlot function. I want to update the same figure with new input values. But when I execute second line, It throws above error and gives updated figure in new window.
I am using Matlab R2017b version.
I have my "fliterPlot" function attached. Any suggestions?
Thanks
Accepted Answer
Steven Lord
on 19 Nov 2019
Your filterPlot function returns the handle to a MATLAB figure. According to its documentation page updateSystem requires its first input to be the "Plot to update with new system data, specified as a plot handle. Typically, you obtain the plot handle as an output argument of a response plotting command such as stepplot or bodeplot. For example, the command h = bodeplot(G) returns a handle to a plot containing the Bode response of a dynamic system, G."
If you're modeling your code after this documentation page note that the first input to updateSystem in the callback is h (the output of stepplot) not f (the output of figure).
If you can describe in more detail specifically how you want your figure and its contents to be updated, we may be able to offer guidance for how to update them.
3 Comments
Steven Lord
on 19 Nov 2019
If you're storing the handles of the lines that you create in a vector of handles, you could change the Visible property of a subset of them to control which ones are visible.
% Create some sample data and set up the axes and the vector of handles
x = 0:0.1:2*pi;
axis([0, 2*pi, -1, 1])
hold on
h = gobjects(1, 5);
% Plot five curves and show the legend associated with the curves
for k = 1:5
h(k) = plot(x, sin(k*x), 'DisplayName', "sin(" + k + "*x)");
end
legend show
pause % so you can see all five curves
% Make the 1st and 3rd curves invisible and update the legend
set(h([1 3]), 'Visible', 'off');
legend show
pause
% Only show the visible lines in the legend
legend(h([2 4 5]))
In this simple example, I chose which curves to make invisible. You could compute the vector [1 3] of curves to make invisible however you want.
% Turn them all back on
set(h, 'Visible', 'on');
% Make the curves corresponding to even values of k disappear
toDisappear = mod(1:5, 2) == 0;
set(h(toDisappear), 'Visible', 'off')
pause
% Make the curves corresponding to prime values of k disappear
set(h, 'Visible', 'on');
set(h(isprime(1:5)), 'Visible', 'off')
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows 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!