📄 modsign.m
字号:
function modsign(p1) %MODSIGN Signal modification tool for nefcon bounded-signal-generator %% See also SNEFSIGN, NEFOPTF. % Author(s): Andreas Nuernberger, 08/1996global NEFCON_SIGNAL RANGE_LIMIT global NEFCON_ACTX NEFCON_LHDL if p1==[] p1 = 'init'; end if strcmp(p1,'init'), % if line already exists delete it h = findobj('Tag', 'signal'); if h ~= [] delete(h); end if NEFCON_SIGNAL == [] % create default signal tstart = RANGE_LIMIT(1,1); tfinal = RANGE_LIMIT(1,2); dt = tfinal-tstart; ylim = get(gca, 'Ylim'); mb = (ylim(2)+ylim(1))*.5; % NEFCON_SIGNAL = [tstart tfinal; mb mb]; % NEFCON_SIGNAL = [tstart [0.1 0.11]*dt tfinal; [0 0 1 1]*(ylim(2)-ylim(1))*0.9]; NEFCON_SIGNAL = [tstart [0.2 0.21]*dt tfinal; [0 0 1 1]]; line(NEFCON_SIGNAL(1,:),NEFCON_SIGNAL(2,:), ... 'Color', 'white', ... 'LineWidth',1, ... 'EraseMode','none', ... 'ButtonDownFcn','modsign(''select'')'); % 'UserData',mfIndex, ... else % display signal line(NEFCON_SIGNAL(1,:),NEFCON_SIGNAL(2,:), ... 'Color', 'white', ... 'LineWidth',1, ... 'ButtonDownFcn','modsign(''select'')', ... 'Tag', 'signal'); % 'EraseMode','none', ... % 'UserData',mfIndex, ... end %button = ' '; %while button ~= 'q' % [x,y,button]=ginput(1) %end elseif strcmp(p1,'select'), % select/move/etc... NEFCON_LHDL=get(gcf,'CurrentObject'); currPt=get(gca,'CurrentPoint'); % insert new point row = 2; while NEFCON_SIGNAL(1, row) < currPt(1,1) row = row + 1; end NEFCON_ACTX = row; NEFCON_SIGNAL = [ NEFCON_SIGNAL(:,1:row-1) [currPt(1,1);currPt(1,2)] ... NEFCON_SIGNAL(:,row:size(NEFCON_SIGNAL,2))]; delete(NEFCON_LHDL); NEFCON_LHDL = line(NEFCON_SIGNAL(1,:), NEFCON_SIGNAL(2,:), ... 'Color', 'red', ... 'LineWidth',3, 'Selected','on', ... 'ButtonDownFcn','', ... 'Tag', 'signal'); % 'EraseMode','none', ... fig = gcf; set(fig,'WindowButtonMotionFcn','modsign(''move'')', ... 'BackingStore','off', ... 'WindowButtonUpFcn','modsign(''btnup'')'); elseif strcmp(p1,'move'), currPt=get(gca,'CurrentPoint'); currPt(1,1) = max(min(currPt(1,1),RANGE_LIMIT(1,2)),RANGE_LIMIT(1,1)); if NEFCON_ACTX <= 1 | NEFCON_ACTX >= size(NEFCON_SIGNAL,2) % NEFCON_SIGNAL(1,NEFCON_ACTX) = currPt(1,1); % leave bound unchanged... elseif currPt(1,1) <= NEFCON_SIGNAL(1,NEFCON_ACTX-1) % remove left point NEFCON_SIGNAL = [NEFCON_SIGNAL(:,1:NEFCON_ACTX-2)... NEFCON_SIGNAL(:,NEFCON_ACTX:size(NEFCON_SIGNAL,2))]; NEFCON_ACTX = NEFCON_ACTX-1; NEFCON_SIGNAL(1,NEFCON_ACTX) = currPt(1,1); elseif currPt(1,1) >= NEFCON_SIGNAL(1,NEFCON_ACTX+1) % remove right point NEFCON_SIGNAL = [NEFCON_SIGNAL(:,1:NEFCON_ACTX)... NEFCON_SIGNAL(:,NEFCON_ACTX+2:size(NEFCON_SIGNAL,2))]; NEFCON_SIGNAL(1,NEFCON_ACTX) = currPt(1,1); else NEFCON_SIGNAL(1,NEFCON_ACTX) = currPt(1,1); end NEFCON_SIGNAL(2,NEFCON_ACTX) = currPt(1,2); delete(NEFCON_LHDL); NEFCON_LHDL = line(NEFCON_SIGNAL(1,:),NEFCON_SIGNAL(2,:), ... 'Color', 'red', ... 'LineWidth',3, 'Selected','on', ... 'ButtonDownFcn','', ... 'Tag', 'signal'); % 'EraseMode','none', ... % set(NEFCON_LHDL, 'Xdata', NEFCON_SIGNAL(1,:)); % set(NEFCON_LHDL, 'Ydata', NEFCON_SIGNAL(2,:)); elseif strcmp(p1,'btnup'), currPt=get(gca,'CurrentPoint'); delete(NEFCON_LHDL); % remove buttonfunctions fig = gcf; set(fig,'WindowButtonMotionFcn','', ... 'WindowButtonUpFcn',''); line(NEFCON_SIGNAL(1,:),NEFCON_SIGNAL(2,:), ... 'Color', 'white', ... 'LineWidth',1, ... 'ButtonDownFcn','modsign(''select'')', ... 'Tag', 'signal'); % 'EraseMode','none', ... end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -