Function with handle.
15 views (last 30 days)
Show older comments
Hi. I need some help with this problem. Can not see what I'm doing wrong.
The function takes an array of plot handles input parameters. The user must enter an ID number on the new graph and enter a text string that is interpreted as a function of x. The graph is shown i the figure window with the number that coincides with the ID number of the new graph. The handle that is drawn is stored in the array passed as inparameter and feature retunera this array to the main menu.
The function mainMeny:
function mainMeny
plot_handles = [];
iterera = true;
while iterera
.
.
.
case 1
plot_handles = skapaPlot(plot_handles);
end
The function skapaplot:
function [plot_handles] = skapaPlot(plot_handles)
% id = input('Ange fönster: ');
[id]=getPlotHandle(plot_handles);
func = inputdlg('Mata in en funktion: ');
x = linspace(0,10,100);
y = eval(func{1});
figure(id);
handle = plot(x,y),grid
plot_handles(id) = handle;
end
Error from MATLAB:
??? Undefined function or method 'getPlotHandle' for input arguments of type 'double'.
Error in ==> skapaPlot at 3 [id]=getPlotHandle(plot_handles);
Error in ==> mainMeny at 22 plot_handles = skapaPlot(plot_handles);
I would be grateful if you could help me.
0 Comments
Answers (2)
Daniel Shub
on 11 Aug 2011
It looks like getPlotHandle is not defined. What do you get with
which -all getPlotHandle
See Also
Categories
Find more on Entering Commands 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!