📄 untitled.m
字号:
hold on;
grid on;
haxes8=axes('box','on','units','normalized','position',[0.12,0.1,0.8,0.78],'tag','haxes8');
hline8=plot(1:2,a8(:,2));
set(hline8,'markersize',10,'erasemode','none');
axis([0 8000 0 5]);
set(haxes8,'visible','off');
set(hline8,'visible','off');
hold on;
grid on;
haxes1=axes('box','on','units','normalized','position',[0.12,0.1,0.8,0.78],'tag','haxes1');
hline1=plot(1:2,a1(:,2));
set(hline1,'markersize',10,'erasemode','none');
axis([0 1000 0 5]);
hold on;
grid on;
set(gcf,'currentaxes',haxes1);
hcurrent=haxes1;
hresult=hline1;
movegui(hmainfig,'center');
set(hmainfig,'visible','on');
set(hmainfig,'windowbuttondownfcn',...
['p=get(gca,''currentpoint'');',...
'global hmainfig;',...
'htext22=getappdata(hmainfig,''htext22'');',...
'htext32=getappdata(hmainfig,''htext32'');',...
'set(htext22,''string'',num2str(p(1)));',...
' set(htext32,''string'',num2str(p(3)));']);
allaxes=[haxes1,haxes2,haxes3,haxes4,haxes5,haxes6,haxes7,haxes8];
allline=[hline1,hline2,hline3,hline4,hline5,hline6,hline7,hline8];
setappdata(hmainfig,'allaxes',allaxes);
setappdata(hmainfig,'allline',allline);
while 1
equation(1)=str2num(hinput2.equation1);
equation(2)=str2num(hinput2.equation2);
equation(3)=str2num(hinput2.equation3);
equation(4)=str2num(hinput2.equation4);
equation(5)=str2num(hinput2.equation5);
equation(6)=str2num(hinput2.equation6);
equation(7)=str2num(hinput2.equation7);
equation(8)=str2num(hinput2.equation8);
for n=1:8
for k=1:2
indata(k)=fscanf(obj1,'%c',1);
if indata(k)>97
indata(k)=indata(k)-87;
else
indata(k)=indata(k)-48;
end
end
m(n)=indata(1).*16+indata(2);
m(n)=m(n)*equation(n);
m(n)=m(n).*1/51;
end
b1=[y+2,m(1)];
b2=[y+2,m(2)];
b3=[y+2,m(3)];
b4=[y+2,m(4)];
b5=[y+2,m(5)];
b6=[y+2,m(6)];
b7=[y+2,m(7)];
b8=[y+2,m(8)];
fid1=fopen(str1,'at+');
fprintf(fid1,' %g %1.4g\n',b1);
fclose(fid1);
fid2=fopen(str2,'at+');
fprintf(fid2,' %g %1.4g\n',b2);
fclose(fid2);
fid3=fopen(str3,'at+');
fprintf(fid3,' %g %1.4g\n',b3);
fclose(fid3);
fid4=fopen(str4,'at+');
fprintf(fid4,' %g %1.4g\n',b4);
fclose(fid4);
fid5=fopen(str5,'at+');
fprintf(fid5,' %g %1.4g\n',b5);
fclose(fid5);
fid6=fopen(str6,'at+');
fprintf(fid6,' %g %1.4g\n',b6);
fclose(fid6);
fid7=fopen(str7,'at+');
fprintf(fid7,' %g %1.4g\n',b7);
fclose(fid7);
fid8=fopen(str8,'at+');
fprintf(fid8,' %g %1.4g\n',b8);
fclose(fid8);
a1=cat(1,a1,b1);
a2=cat(1,a2,b2);
a3=cat(1,a3,b3);
a4=cat(1,a4,b4);
a5=cat(1,a5,b5);
a6=cat(1,a6,b6);
a7=cat(1,a7,b7);
a8=cat(1,a8,b8);
t=1:y+2;
set(hline1,'xdata',t,'ydata',a1(:,2));
set(hline2,'xdata',t,'ydata',a2(:,2));
set(hline3,'xdata',t,'ydata',a3(:,2));
set(hline4,'xdata',t,'ydata',a4(:,2));
set(hline5,'xdata',t,'ydata',a5(:,2));
set(hline6,'xdata',t,'ydata',a6(:,2));
set(hline7,'xdata',t,'ydata',a7(:,2));
set(hline8,'xdata',t,'ydata',a8(:,2));
drawnow;
y=y+1;
set(huipushtool1,'clickedcallback',@huipushtool1_callback);
set(huipushtool2,'clickedcallback',@huipushtool2_callback);
set(huipushtool3,'clickedcallback',@huipushtool3_callback);
set(huipushtool4,'clickedcallback',@huipushtool4_callback);
set(huipushtool5,'clickedcallback',@huipushtool5_callback);
set(huipushtool6,'clickedcallback',@huipushtool6_callback);
set(huipushtool7,'clickedcallback',@huipushtool7_callback);
set(huipushtool8,'clickedcallback',@huipushtool8_callback);
set(huipushtoolcons,'clickedcallback',@bijiao);
pause(sampletime);
end
% disconnect all objects.
fclose(obj1);
%clean up all objects.
delete(obj1);
clear obj1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%下面这个子函数是用来对当前的图形进行保存,用户可以保存成.bmp文件或.jpg或其它的等等格式。
function saveasfcn(hobject,eventdata,handles)
global hresult;
[filename, pathname, filterindex] = uiputfile( ...
{'*.bmp;*.fig;*.tif','Picture styles (*.bmp,*.fig,*.tif)';
'*.bmp', 'Bitmap-files (*.bmp)'; ...
'*.fig','Figures-files (*.fig)'; ...
'*.tif','Gif-files (*.tif)'; ...
'*.*', 'All Files (*.*)'}, ...
'Save as');
if isequal([filename,pathname],[0,0]) % If 'Cancel' was selected then return
return
else
File = fullfile(pathname,filename); % Construct the full path and save
saveas(hresult,File)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%这个函数用来弹出一个下拉式对话框,让用户选择一个通道。
function setup_dlg(hobject,eventdata,handles)
global hmainfig hresult;
allaxes=getappdata(hmainfig,'allaxes');
allline=getappdata(hmainfig,'allline');
channelstr={'channel 1','channel 2','channel 3','channel 4','channel 5','channel 6','channel 7','channel 8'};
[s,v]=listdlg('promptstring','请选择其中一个','selectionmode','single','name','请选择通道','liststring',channelstr,...
'fus',10,'listsize',[200 100]);
prompt={'Xmin','Xmax','Ymin','Ymax'};
title=['setup for channel_',sprintf('%g',s)];
defaults={'0','10000','-5','5'};
inputdlg_1=inputdlg(prompt,title,1,defaults);
axes_cells=str2num(char(inputdlg_1));
Xmin=axes_cells(1);
Xmax=axes_cells(2);
Ymin=axes_cells(3);
Ymax=axes_cells(4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -