Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Call_Click(~,~,Num)
- key = get(gcf, 'SelectionType');
- if isequal(key,'alt')
- h=get(Slider,'value');
- if flag==1
- Prev_Data_1=Prev_Data_1*h;
- Plot(Prev_Data_1);
- elseif flag==3
- Prev_Data_1=Energy2(Data,c1);
- Plot(Prev_Data_1);
- end
- elseif isequal (key,'normal')
- if f==1
- set(findall(0,'tag',int2str(Num2)),'color','b');
- trace=Data(:,Num);
- set(findall(0,'tag',int2str(Num)),'color','r');
- Num2=Num;
- elseif f==2
- % delete (findall(0,'tag',['peak' int2str(Num)]));
- pos=get(Axes,'CurrentPoint');
- p(1:2,1)=pos(1,1);
- peak(Num)=p(1,1);
- y(1,1)=Num-1/4;
- y(2,1)=Num+1/4;
- line('tag',['peak' int2str(Num)],'Parent',Axes,'XData',p(:,1),'YData',y,...
- 'color','r','linewidth',2);
- elseif f==3
- z=1;
- pos=get(Axes,'CurrentPoint');
- p(1:2,1)=pos(1,1);
- peak(Num)=p(1,1);
- y(1,1)=Num-1/4;
- y(2,1)=Num+1/4;
- line('tag',['peak' int2str(Num)],'Parent',Axes,'XData',p(:,1),'YData',y,...
- 'color','r','linewidth',2);
- elseif f==4
- waitforbuttonpress;
- point1 = get(Axes,'CurrentPoint'); % button down detected
- finalRect = rbbox; % return figure units
- point2 = get(Axes,'CurrentPoint'); % button up detected
- point1 = point1(1,1:2); % extract x and y
- point2 = point2(1,1:2);
- p1 = min(point1,point2); % calculate locations
- offset = abs(point1-point2); % and dimensions
- X = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];
- Y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];
- hold on
- axis (Axes,[min(X) max(X) min(Y) max(Y)]);
- plot(X,Y) % redraw in dataspace units
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement