1、(完整版)matlab magnify 源程序% start of program function magnify(f1) magnify(f1)% Figure creates a magnification box when under the mouse position when a button is pressed。 Press +/ while% button pressed to increase/decrease magnification. Press /) | strcmp(get(f1,CurrentCharacter),。) a2_param(2) = a2_par
2、am(2)*1.2; end; set(a2,UserData,a2_param); ButtonMotionCallback(src); end;return;% Included for completeness (usually in own file)function fig_pointer_pos, axes_pointer_val = pointer2d(fig_hndl,axes_hndl)%pointer2d(fig_hndl,axes_hndl)Returns the coordinates of the pointer (in pixels)in the desired f
3、igure (fig_hndl) and the coordinates% in the desired axis (axes coordinates)% Example: figure(1),% hold on, for i = 1:1000, figp,axp=pointer2d; plot(axp(1),axp(2),.,EraseMode,none); drawnow; end;% hold off Rick Hindman - 4/18/01if (nargin = 0), fig_hndl = gcf; axes_hndl = gca; end;if (nargin = 1), a
4、xes_hndl = get(fig_hndl,CurrentAxes); end;set(fig_hndl,Units,pixels);pointer_pos = get(0,PointerLocation);%pixels 0,0 lower leftfig_pos = get(fig_hndl,Position);pixels l,b,w,hfig_pointer_pos = pointer_pos fig_pos(1,2);set(fig_hndl,CurrentPoint,fig_pointer_pos);if (isempty(axes_hndl)),axes_pointer_val = ;elseif (nargout = 2),axes_pointer_line = get(axes_hndl,CurrentPoint);axes_pointer_val = sum(axes_pointer_line)/2;end;% end of program