📄 untitled10.m
字号:
close all;clc;clear;
st=1; % deafault step length
figure;
set(gcf,'DoubleBuffer','on');
aa=axes('position',[0.1,0.1,0.8,0.6]);hold on;
set(aa,'ButtonDownFcn',['po=get(gca,''CurrentPoint'');',...
'set(pr,''XData'',po(1)*[1,1]);',...
'ck=get(gcf,''CurrentKey'')']);
set(gcf,'KeyPressFcn',['ck=get(gcf,''CurrentKey'');',...
'switch ck; case ''leftarrow''; s=-1;case ''rightarrow'';s=1;end;',...
'set(pr,''XData'',get(pr,''XData'')+s*st);']);
% \copyright: zjliu
% Author's email: zjliu2001@163.com
uicontrol(gcf,'style','push','unit','normalized',...
'position',[0.12,0.9,0.6,0.07],...
'string','Please select data file for x-axis:',...
'fontsize',16,'fontname','times new roman',...
'BackgroundColor',[0.8,0.8,0.8],'callback',[...
'[filenamex, pathnamex] = uigetfile;',...
'dx=plot([pathnamex,filenamex]);dx=dx(:);']);
uicontrol(gcf,'style','push','unit','normalized',...
'position',[0.12,0.82,0.6,0.07],...
'string','Please select data file for y-axis:',...
'fontsize',16,'fontname','times new roman',...
'BackgroundColor',[0.8,0.8,0.8],'callback',[...
'[filenamey, pathnamey] = uigetfile;',...
'dy=plot([pathnamey,filenamey]);dy=dy(:);',...
'if isempty(dx);dx=[1:length(dy)]'';end;plot(dx,dy);']);
uicontrol(gcf,'style','push','unit','normalized',...
'position',[0.12,0.74,0.6,0.07],...
'string','using random number for y-axis:',...
'fontsize',16,'fontname','times new roman','ForegroundColor','r',...
'BackgroundColor',[0.8,0.8,0.8],'callback',[
'plot(1:100,rand(100,1));']);
uicontrol(gcf,'style','push','unit','normalized',...
'position',[0.74,0.74,0.24,0.07],...
'string','show red line',...
'fontsize',16,'fontname','times new roman','ForegroundColor','r',...
'BackgroundColor',[0.8,0.8,0.8],'callback',[
'hold on;pr=plot(mean(xlim)*[1,1],ylim,''r'',''linewidth'',1);']);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -