Function with handle.
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Daniel Shub
2011-8-11
It looks like getPlotHandle is not defined. What do you get with
which -all getPlotHandle
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!