images/first slide previous slide next slide last slide       Introduction Matlab Graphics       Academic Computing                



Basic Matlab Graphics

Try:
>>
% draw a dot inside a square with no axis
fig_handle=figure(1);
cla;
[hdot,hline] = graphdot([1 0 0]);
% draw an x where user clicks in the figure
% stop when user hits a key
k=-1;
while k ~=1
   k=waitforbuttonpress;
   % get the coordinates of the point where user has clicked mouse
   pos= get(gca,'CurrentPoint');
   text(pos(1,1),pos(1,2),'x');
end
ylim=get(gca,'YLim');
xlim=get(gca,'XLim');
text(xlim(1),ylim(1),'All done');
>> mouseclick