movept.m

来自「细胞生长结构可视化工具箱-MATLAB Toolbox1999.zip」· M 代码 · 共 48 行

M
48
字号
% Allow user to move a point by identifying it with the mouse and clicking
% on the new position

function movept(filename)

eval(['load ', filename]);

figure(1);
clf;
%subplot(1,2,1);
plotv2;

cont=1;

while cont == 1
	title('Left click on point to be moved. Right click to end.');
	[X,Y,Button] = ginput(1);
	if Button == 2
		cont = 0;
		break;
	end

	% Compute distances to nodes from pt
	dis=zeros(size(wvis,1),1);
	for i=1:size(wvis,1)
		dis(i) = norm([X,Y]-wvis(i,:));
	end
	[minval,s] = min(dis);
	
	title('Click on new location');
	[X,Y,Button] = ginput(1);
	wvis(s,:) = [X,Y];
	if Button == 2
		cont = 0;
	end

	if filename(size(filename,2)) ~= 'a'
		filename = [filename '_a'];
	end

	%subplot(1,2,2);
	clf;
	plotv2;
	title('Move complete');
	
	eval(['save ' filename]);
	%disp(filename);
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?