久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1919|回復: 0
打印 上一主題 下一主題
收起左側

matlab中GUI的串口調試程序

[復制鏈接]
跳轉到指定樓層
樓主
ID:336578 發表于 2018-5-23 15:58 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
%     UNTITLED, by itself, creates a new UNTITLED or raises the existing
%     singleton*.
%
%     H = UNTITLED returns the handle to a new UNTITLED or the handle to
%     the existing singleton*.
%
%     UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
%     function named CALLBACK in UNTITLED.M with the given input arguments.
%
%     UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
%      existing singleton*.  Starting from the left, property value pairsare
%     applied to the GUI before untitled_OpeningFcn gets called.  An
%     unrecognized property name or invalid value makes property application
%     stop.  All inputs are passed tountitled_OpeningFcn via varargin.
%
%     *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%     instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify theresponse to help untitled
% Last Modified by GUIDE v2.5 07-Sep-201313:47:05
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn',@untitled_OpeningFcn, ...
                   'gui_OutputFcn',  @untitled_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
   gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
   [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
   gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before untitled is madevisible.
function untitled_OpeningFcn(hObject,eventdata, handles, varargin)
% This function has no output args, seeOutputFcn.
% hObject   handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% varargin  command line arguments to untitled (see VARARGIN)
% 初始化
set(handles.caiji,'UserData',0);
setappdata(handles.save,'ApplicationData',0);
% Choose default command line output foruntitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled wait for userresponse (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function arereturned to the command line.
function varargout = untitled_OutputFcn(hObject,eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject   handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Get default command line output fromhandles structure
varargout{1} = handles.output;
% --- Executes on button press in on.
function on_Callback(hObject, eventdata,handles)
% hObject   handle to on (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
clc;
s1 =instrfind('Type','serial','Port','COM1','Tag','');    % 查看端口是否存在
s2 =instrfind('Type','serial','Port','COM2','Tag','');
s3 =instrfind('Type','serial','Port','COM3','Tag','');    % 查看端口是否存在
s4 =instrfind('Type','serial','Port','COM4','Tag','');
% 獲取參數值
if (isempty(s1) &&get(handles.port,'Value')==1 )          % 如果端口1存在,存創建端口
    s= serial('COM1');                   % 創建串口號
   if(get(handles.botelv,'Value')==1)   % 設置串口參數
       s.BaudRate = 1200;                  
   elseif(get(handles.botelv,'Value')==2)
       s.BaudRate = 2400;   
   elseif(get(handles.botelv,'Value')==3)
       s.BaudRate = 4800;   
    elseif(get(handles.botelv,'Value')==4)
       s.BaudRate = 9600;  
   elseif(get(handles.botelv,'Value')==5)
       s.BaudRate = 19200;
   elseif(get(handles.botelv,'Value')==6)
       s.BaudRate = 38400;
   elseif(get(handles.botelv,'Value')==7)
       s.BaudRate = 76800;
   elseif(get(handles.botelv,'Value')==8)
       s.BaudRate = 115200;  
   end
   if(get(handles.jiaoyanw,'Value')==1)
       s.Parity = 'none';                     % 無校驗位
   elseif(get(handles.jiaoyanw,'Value')==2)
       s.Parity = 'odd';                     % 偶校驗
   elseif(get(handles.jiaoyanw,'Value')==3)
       s.Parity = 'even';                     % 奇校驗
   end
   if(get(handles.dataw,'Value')==1)           % 數據位
       s.DataBits = 8;
   elseif(get(handles.dataw,'Value')==2)
       s.DataBits = 7;
   elseif(get(handles.dataw,'Value')==3)
       s.DataBits = 6;
   elseif(get(handles.dataw,'Value')==4)
       s.DataBits = 5;
   end
   if(get(handles.stopw,'Value')==1)           % 停止位
       s.StopBits = 1;
   elseif(get(handles.stopw,'Value')==2)
       s.StopBits = 1.5;
   elseif(get(handles.stopw,'Value')==3)
       s.StopBits = 2;  
   end
   s.Timeout = 0.1;
   s.InputBufferSize = 3072;
   s.OutputBufferSize = 3072;
   s.ReadAsyncMode = 'continuous';
   
   handles.sbuff = s;
   guidata(hObject, handles);
   s.BytesAvailableFcnMode = 'byte';
   s.BytesAvailableFcnCount = 10;
   s.BytesAvailableFcn = {@recive_data, handles};
   fopen(s);
   set(handles.caiji,'Enable','On');
   set(handles.off,'Enable','On');
   set(handles.on,'Enable','Off');
   set(handles.edit1,'String','打開成功!');
   set(handles.exit,'Enable','Off');
   set(handles.edit1,'backgroundcolor',[0 1 0]);
   
elseif (isempty(s2) &&get(handles.port,'Value')==2 )        % 如果端口2存在,存創建端口
    s= serial('COM2');                   % 創建串口號
   if(get(handles.botelv,'Value')==1)   % 設置串口參數
       s.BaudRate = 1200;                  
   elseif(get(handles.botelv,'Value')==2)
       s.BaudRate = 2400;   
   elseif(get(handles.botelv,'Value')==3)
       s.BaudRate = 4800;   
   elseif(get(handles.botelv,'Value')==4)
       s.BaudRate = 9600;  
   elseif(get(handles.botelv,'Value')==5)
       s.BaudRate = 19200;
   elseif(get(handles.botelv,'Value')==6)
       s.BaudRate = 38400;
   elseif(get(handles.botelv,'Value')==7)
       s.BaudRate = 76800;
   elseif(get(handles.botelv,'Value')==8)
       s.BaudRate = 115200;  
   end
   if(get(handles.jiaoyanw,'Value')==1)
       s.Parity = 'none';                     % 無校驗位
   elseif(get(handles.jiaoyanw,'Value')==2)
       s.Parity = 'odd';                     % 偶校驗
   elseif(get(handles.jiaoyanw,'Value')==3)
       s.Parity = 'even';                     % 奇校驗
    end
   if(get(handles.dataw,'Value')==1)           % 數據位
       s.DataBits = 8;
   elseif(get(handles.dataw,'Value')==2)
       s.DataBits = 7;
   elseif(get(handles.dataw,'Value')==3)
       s.DataBits = 6;
   elseif(get(handles.dataw,'Value')==4)
       s.DataBits = 5;
   end
   if(get(handles.stopw,'Value')==1)           % 停止位
       s.StopBits = 1;
   elseif(get(handles.stopw,'Value')==2)
       s.StopBits = 1.5;
   elseif(get(handles.stopw,'Value')==3)
       s.StopBits = 2;  
   end
    s.Timeout = 0.1;
   s.InputBufferSize = 3072;
   s.OutputBufferSize = 3072;
   s.ReadAsyncMode = 'continuous';
   
   handles.sbuff = s;
   guidata(hObject, handles);
   s.BytesAvailableFcnMode = 'byte';
   s.BytesAvailableFcnCount = 10;
   s.BytesAvailableFcn = {@recive_data, handles};
   fopen(s);
   set(handles.caiji,'Enable','On');
   set(handles.off,'Enable','On');
   set(handles.on,'Enable','Off');
   set(handles.exit,'Enable','Off');
   set(handles.edit1,'String','打開成功!');
    set(handles.edit1,'backgroundcolor',[0 1 0]);
   
elseif (isempty(s3) &&get(handles.port,'Value')==3 )        % 如果端口3存在,存創建端口
    s= serial('COM3');                   % 創建串口號
   if(get(handles.botelv,'Value')==1)   % 設置串口參數
       s.BaudRate = 1200;                  
   elseif(get(handles.botelv,'Value')==2)
       s.BaudRate = 2400;   
   elseif(get(handles.botelv,'Value')==3)
       s.BaudRate = 4800;   
   elseif(get(handles.botelv,'Value')==4)
       s.BaudRate = 9600;  
   elseif(get(handles.botelv,'Value')==5)
       s.BaudRate = 19200;
   elseif(get(handles.botelv,'Value')==6)
       s.BaudRate = 38400;
   elseif(get(handles.botelv,'Value')==7)
       s.BaudRate = 76800;
   elseif(get(handles.botelv,'Value')==8)
       s.BaudRate = 115200;  
   end
   if(get(handles.jiaoyanw,'Value')==1)
       s.Parity = 'none';                     % 無校驗位
   elseif(get(handles.jiaoyanw,'Value')==2)
       s.Parity = 'odd';                     % 偶校驗
   elseif(get(handles.jiaoyanw,'Value')==3)
       s.Parity = 'even';                     % 奇校驗
   end
   if(get(handles.dataw,'Value')==1)           % 數據位
       s.DataBits = 8;
   elseif(get(handles.dataw,'Value')==2)
       s.DataBits = 7;
    elseif(get(handles.dataw,'Value')==3)
       s.DataBits = 6;
   elseif(get(handles.dataw,'Value')==4)
       s.DataBits = 5;
   end
   if(get(handles.stopw,'Value')==1)           % 停止位
       s.StopBits = 1;
   elseif(get(handles.stopw,'Value')==2)
        s.StopBits = 1.5;
   elseif(get(handles.stopw,'Value')==3)
       s.StopBits = 2;  
   end
   s.Timeout = 0.1;
   s.InputBufferSize = 3072;
   s.OutputBufferSize = 3072;
   s.ReadAsyncMode = 'continuous';
   
   handles.sbuff = s;
   guidata(hObject, handles);
   s.BytesAvailableFcnMode = 'byte';
   s.BytesAvailableFcnCount = 10;
   s.BytesAvailableFcn = {@recive_data, handles};
   fopen(s);
   set(handles.caiji,'Enable','On');
   set(handles.off,'Enable','On');
   set(handles.on,'Enable','Off');
   set(handles.exit,'Enable','Off');
   set(handles.edit1,'String','打開成功!');
   set(handles.edit1,'backgroundcolor',[0 1 0]);
   
elseif (isempty(s4) &&get(handles.port,'Value')==4 )        % 如果端口4存在,存創建端口
    s= serial('COM4');                   % 創建串口號
   if(get(handles.botelv,'Value')==1)   % 設置串口參數
       s.BaudRate = 1200;                  
   elseif(get(handles.botelv,'Value')==2)
       s.BaudRate = 2400;   
   elseif(get(handles.botelv,'Value')==3)
       s.BaudRate = 4800;   
   elseif(get(handles.botelv,'Value')==4)
       s.BaudRate = 9600;  
   elseif(get(handles.botelv,'Value')==5)
       s.BaudRate = 19200;
   elseif(get(handles.botelv,'Value')==6)
       s.BaudRate = 38400;
   elseif(get(handles.botelv,'Value')==7)
       s.BaudRate = 76800;
   elseif(get(handles.botelv,'Value')==8)
       s.BaudRate = 115200;  
   end
   if(get(handles.jiaoyanw,'Value')==1)
       s.Parity = 'none';                     % 無校驗位
   elseif(get(handles.jiaoyanw,'Value')==2)
       s.Parity = 'odd';                     % 偶校驗
   elseif(get(handles.jiaoyanw,'Value')==3)
       s.Parity = 'even';                     % 奇校驗
   end
   if(get(handles.dataw,'Value')==1)           % 數據位
       s.DataBits = 8;
   elseif(get(handles.dataw,'Value')==2)
       s.DataBits = 7;
   elseif(get(handles.dataw,'Value')==3)
       s.DataBits = 6;
   elseif(get(handles.dataw,'Value')==4)
       s.DataBits = 5;
   end
   if(get(handles.stopw,'Value')==1)           % 停止位
       s.StopBits = 1;
   elseif(get(handles.stopw,'Value')==2)
       s.StopBits = 1.5;
   elseif(get(handles.stopw,'Value')==3)
       s.StopBits = 2;  
   end
   s.Timeout = 0.1;
   s.InputBufferSize = 3072;
   s.OutputBufferSize = 3072;
   s.ReadAsyncMode = 'continuous';
   
   handles.sbuff = s;
   guidata(hObject, handles);
   s.BytesAvailableFcnMode = 'byte';
   s.BytesAvailableFcnCount = 10;
   s.BytesAvailableFcn = {@recive_data, handles};
   fopen(s);
   set(handles.caiji,'Enable','On');
   set(handles.off,'Enable','On');
   set(handles.on,'Enable','Off');
   set(handles.exit,'Enable','Off');
   set(handles.edit1,'String','打開成功!');
   set(handles.edit1,'backgroundcolor',[0 1 0]);
else
   msgbox('串口不存在或被占用!');
   set(handles.edit1,'String','打開失敗!');
   set(handles.edit1,'backgroundcolor',[1 0/255 0]);
end
   
% 中斷處理程序
function recive_data(t,  event, handles)
if(getappdata(handles.caiji,'ApplicationData')~=0)            % 收到單擊采集信號的信息
   
    g= handles.sbuff;
   [out,huanchongcout] = fread(g,10);                       % 讀取數據
%    plot(handles.axes1,out);  
    %解析數據
   if(out(1)==128 &&bitxor(bitxor(bitxor(bitxor(out(2),out(3)),out(4)),out(5)),out(6)) == out(7))
       data2 = dec2bin(out(2),8);
       data3 = dec2bin(out(3),8);
       data4 = dec2bin(out(4),8);
       data5 = dec2bin(out(5),8);
       data6 = dec2bin(out(6),8);
       cur_data0 = 0;      % 初始化脈沖值
       cur_data1 = dec2bin(cur_data0,32);  % 轉成二進制,有效位數為32
       cur_data1(1:4) = data6(5:8);
       cur_data1(5:11) = data5(2:8);
       cur_data1(12:18) = data4(2:8);
       cur_data1(19:25) = data3(2:8);
       cur_data1(26:32) = data2(2:8);
       cur_data2 = cur_data1;
       set(handles.current_data,'String',bin2dec(cur_data2));
   end
   
   
   if(getappdata(handles.save,'ApplicationData') ~=0)        % 開始存儲數據
      
       File = get(handles.save_play,'String');
       fid = fopen(File,'a');
       fprintf(fid,'%d\t',bin2dec(cur_data2));
       fprintf(fid,'\n');
       fclose(fid);
      
   end      
end  
% --- Executes on button press in off.
function off_Callback(hObject, eventdata,handles)
% hObject   handle to off (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
    s= handles.sbuff;      % 傳遞
   fclose(s);              % 關閉串口設備對象
   delete(s);              % 刪除內存中的串口設備對象
   clear s;                % 清除工作區間的串口設備對象
   setappdata(handles.axes1,'ApplicationData',0);  % 清空緩存數據
   set(handles.axes1,'UserData',0);                % 將計數器清0
   set(handles.save,'UserData',0);                 % 將數據保存區清0
   set(handles.edit1,'String','串口關閉');
   set(handles.edit1,'backgroundcolor',[0 0/255 1]);
   set(handles.caiji,'Enable','Off');
   set(handles.on,'Enable','On');
   set(handles.save,'Enable','Off');
   set(handles.off,'Enable','Off');
   set(handles.exit,'Enable','On');
% --- Executes on selection change in port.
function port_Callback(hObject, eventdata,handles)
% hObject   handle to port (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String'))returns port contents as cell array
%       contents{get(hObject,'Value')} returns selected item from port
% --- Executes during object creation,after setting all properties.
function port_CreateFcn(hObject, eventdata,handles)
% hObject   handle to port (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have awhite background on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change inbotelv.
function botelv_Callback(hObject,eventdata, handles)
% hObject   handle to botelv (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: contents =cellstr(get(hObject,'String')) returns botelv contents as cell array
%       contents{get(hObject,'Value')} returns selected item from botelv
% --- Executes during object creation,after setting all properties.
function botelv_CreateFcn(hObject,eventdata, handles)
% hObject   handle to botelv (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have awhite background on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change indataw.
function dataw_Callback(hObject, eventdata,handles)
% hObject   handle to dataw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: contents =cellstr(get(hObject,'String')) returns dataw contents as cell array
%       contents{get(hObject,'Value')} returns selected item from dataw
% --- Executes during object creation,after setting all properties.
function dataw_CreateFcn(hObject,eventdata, handles)
% hObject   handle to dataw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have awhite background on Windows.
%      See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change injiaoyanw.
function jiaoyanw_Callback(hObject,eventdata, handles)
% hObject   handle to jiaoyanw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: contents =cellstr(get(hObject,'String')) returns jiaoyanw contents as cell array
%       contents{get(hObject,'Value')} returns selected item from jiaoyanw
% --- Executes during object creation,after setting all properties.
function jiaoyanw_CreateFcn(hObject,eventdata, handles)
% hObject   handle to jiaoyanw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have awhite background on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change instopw.
function stopw_Callback(hObject, eventdata,handles)
% hObject   handle to stopw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: contents =cellstr(get(hObject,'String')) returns stopw contents as cell array
%       contents{get(hObject,'Value')} returns selected item from stopw
% --- Executes during object creation,after setting all properties.
function stopw_CreateFcn(hObject,eventdata, handles)
% hObject   handle to stopw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have awhite background on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation,after setting all properties.
function axes1_CreateFcn(hObject,eventdata, handles)
% hObject   handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn topopulate axes1
if ispc &&isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in caiji.
function caiji_Callback(hObject, eventdata,handles)
% hObject   handle to caiji (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% data = handles.data;
% 發送信號,傳遞給中斷,將信號暫存在采集控件中
% t =str2num(get(handles.save_time,'String'));
index =get(handles.save_lujin,'UserData');        % 是否設定存儲路徑
g = handles.sbuff;
[a,b] = fread(g);
if ( b==0 )
   msgbox('當前無數據輸入!');
   set(handles.save,'Enable','Off');
else
   if(get(handles.caiji,'UserData')==0)
       set(handles.caiji,'String','停止采集');
       set(handles.caiji,'BackgroundColor',[1 0 0]);
       setappdata(handles.caiji,'ApplicationData',1);   % 用于傳遞給中斷響應函數,可以接收并顯示數據了
       set(handles.caiji,'UserData',1);
       if(  index~=0 )                                       % 設定存儲條件
           set(handles.save,'Enable','On');
       else
           set(handles.save,'Enable','Off');
       end
   else
       set(handles.caiji,'String','開始采集');
       setappdata(handles.caiji,'ApplicationData',0);
       set(handles.caiji,'BackgroundColor',[0.8 0.8 0.8]);
       set(handles.caiji,'UserData',0);
       set(handles.save,'Enable','Off');
       set(handles.save_time,'String',0);
   end
   
end
% --- Executes on button press in save.
function save_Callback(hObject, eventdata,handles)
% hObject   handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% 發送開始存儲信號,并帶有時間控制功能
setappdata(handles.save,'ApplicationData',1);
% g = handles.sbuff;
% [data,b] = fread(g)
  t =str2num(get(handles.save_time,'String'));
acc_time = t;        % 中間變量     
set(handles.time_play,'String',num2str(t));
  fori = 1:t         % 時間顯示     
     
    pause(0.995);
    set(handles.time_play,'String',num2str(acc_time-1));   
    acc_time = acc_time-1;     
     
end   
setappdata(handles.save,'ApplicationData',0);
%  File = get(handles.save_play,'String');                     % 獲取存儲路徑
%  fopen(File);
%   g= handles.sbuff;
%  [data,b] = fread(g)
%  fprintf(File,'%12.8e\t',data);
% save ( File ,'uint8','data');
% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata,handles)
% hObject   handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
close(gcbf);
function save_play_Callback(hObject,eventdata, handles)
% hObject   handle to save_play (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returnscontents of save_play as text
%       str2double(get(hObject,'String')) returns contents of save_play as adouble
% --- Executes during object creation,after setting all properties.
function save_play_CreateFcn(hObject,eventdata, handles)
% hObject   handle to save_play (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a whitebackground on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes on button press insave_lujin.
function save_lujin_Callback(hObject,eventdata, handles)
% hObject   handle to save_lujin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
set(handles.save,'Enable','On');
[file, pathname, index] =uiputfile({'*.txt';'*.dat';'*.mat'},'文件另存為');
file1 = strcat(pathname,file);
set(handles.save_play,'String',file1);
set(handles.save_lujin,'UserData',index);      % 判斷是否設定了保存文件的路徑
function save_time_Callback(hObject, eventdata,handles)
% hObject   handle to save_time (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returnscontents of save_time as text
%       str2double(get(hObject,'String')) returns contents of save_time as adouble
% --- Executes during object creation,after setting all properties.
function save_time_CreateFcn(hObject,eventdata, handles)
% hObject   handle to save_time (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a whitebackground on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation,after setting all properties.
function time_play_CreateFcn(hObject, eventdata,handles)
% hObject   handle to time_play (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
function current_data_Callback(hObject,eventdata, handles)
% hObject   handle to current_data (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returnscontents of current_data as text
%       str2double(get(hObject,'String')) returns contents of current_data as adouble
% --- Executes during object creation,after setting all properties.
function current_data_CreateFcn(hObject,eventdata, handles)
% hObject   handle to current_data (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a whitebackground on Windows.
%      See ISPC and COMPUTER.
if ispc &&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
   set(hObject,'BackgroundColor','white');
end

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 欧美日韩电影一区 | 午夜资源 | 视频一区二区在线观看 | 国产精品一区二区三区在线 | 日本黄色的视频 | 黑人巨大精品欧美黑白配亚洲 | 国产精品成人一区 | 91视频在线看 | 狠狠狠| 9999国产精品欧美久久久久久 | 国产成人精品午夜视频免费 | 亚洲成人av在线播放 | 天天玩夜夜操 | 亚洲社区在线 | 国产激情在线看 | 粉色午夜视频 | 97色在线观看免费视频 | 91在线精品秘密一区二区 | 欧美日韩不卡合集视频 | 黄色成人亚洲 | 岛国精品 | 久久福利网站 | 日韩精品一区二区三区视频播放 | 91精品久久久久久久久99蜜臂 | 成人免费在线视频 | 91久久精品日日躁夜夜躁国产 | 欧美黄色网 | 国产精品成人在线 | 精品久久久久久久久久久久久 | 亚洲一区久久 | 午夜小电影 | 亚洲一区中文 | 欧美日韩国产精品激情在线播放 | 亚洲欧洲中文 | 欧美在线日韩 | 在线播放中文 | 国产一区二区精品在线观看 | 国产日韩精品一区 | 国产999精品久久久 午夜天堂精品久久久久 | 日韩福利| 在线亚洲免费视频 |