Change LineWidth with help of a function.

조회 수: 7 (최근 30일)
Martin
Martin 2011년 8월 14일
I want the function to change the width of an already existing graph.
Calling the bytBredd. Loads the new width of the graph (a numeric value) and change in the plot as plot_handle suggest bytBredd(plot_handle).
The function bytBredd.m
function plot_handles= bytBredd(plot_handles)
bredd = inputdlg('Vilken bredd vill du ha? ');
id=getPlotHandle(plot_handles); % anropa getplothandle
figure(id);
plot_handle = get(gca,'Children');
handle=set(plot_handle,'LineWidth',bredd);
plot_handles(id) = handle;
end
Error message:
??? Undefined function or method 'getPlotHandle' for input arguments of type 'double'.
Error in ==> bytBredd at 3 id=getPlotHandle(plot_handles); % anropa getplothandle
Error in ==> mainMeny at 27 bytBredd(plot_handles);
Grateful for the help.
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2011년 8월 14일
You didn't show the function getPlotHandle().

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

답변 (1개)

Paulo Silva
Paulo Silva 2011년 8월 14일
You don't have the getPlotHandle function!
  댓글 수: 1
Martin
Martin 2011년 8월 14일
Here is the function that I run to draw the graph.
function [plot_handles] = skapaPlot(plot_handles)
%[id]=getPlotHandle(plot_handles);
id = input('Ange fönster: ');
which -all getPlotHandle;
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

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by