Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: pushbutton saving problem
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
palmar

Posts: 48
Registered: 11/16/07
pushbutton saving problem
Posted: May 15, 2014 7:03 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi there

I have a 2d plot (hhh handle) done with imagesc to which I want to add a line if a pushbutton is pressed, and remove the same lien if the push button is released.

When the pushbutton is pressed the line shows OK, however if the pushbutton is released there is this error:

Undefined function or variable 'Hline'

Lokks line the program can´t remember the Hline value even it is being updated with guidata. What am I doing wrong? Thanks

Here is the function

function abc(x)
% x is a m x n matrix
hhh=imagesc(x)

% now a pushbutton to put or remove a line in the above plot

uicontrol('Style','radiobutton','String','put_remove_line',...
'units','normalized','pos', [tf_left 0 .1/2 1/25],'parent',hhh,'HandleVisibility','on', 'fontSize',6,'Callback',{@put_remove_line ,delta_f_line, hhh ,Hline});

end % end abc function
%radiobutton callback function

function put_remove_line(hObject,event,delta_f_line,hhh,Hline)

a=get(hObject,'Value');
if a % if button is pressed a
axes(hhh)
xlimits=get(gca,'XLim');
Hline.xxx=line(xlimits,[delta_f_line], 'LineStyle',':','LineWidth',2);

else
delete(Hline.xxx,)
end
guidata(hObject,Hline)
end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.