⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qq1.m

📁 应用matlab对数据进行处理
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = qq1(varargin)
% QQ1 M-file for qq1.fig
%      QQ1, by itself, creates a new QQ1 or raises the existing
%      singleton*.
%
%      H = QQ1 returns the handle to a new QQ1 or the handle to
%      the existing singleton*.
%
%      QQ1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in QQ1.M with the given input arguments.
%
%      QQ1('Property','Value',...) creates a new QQ1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before qq1_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to qq1_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 the response to help qq1

% Last Modified by GUIDE v2.5 30-Jul-2006 09:06:16

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @qq1_OpeningFcn, ...
                   'gui_OutputFcn',  @qq1_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 qq1 is made visible.
function qq1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% 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 qq1 (see VARARGIN)

% Choose default command line output for qq1
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes qq1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = qq1_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 from handles structure
varargout{1} = handles.output;



% --------------------------------------------------------------------
function File_Callback(hObject, eventdata, handles)
% hObject    handle to File (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function open_Callback(hObject, eventdata, handles)
% hObject    handle to open (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 

 
% --------------------------------------------------------------------
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)


% --------------------------------------------------------------------
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)
set(handles.exit,'callback','close');

% --------------------------------------------------------------------
function View_Callback(hObject, eventdata, handles)
% hObject    handle to View (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function edit_Callback(hObject, eventdata, handles)
% hObject    handle to edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function xls_Callback(hObject, eventdata, handles)
% hObject    handle to xls (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.xls,'callback','filname');


% --------------------------------------------------------------------
function mat_Callback(hObject, eventdata, handles)
% hObject    handle to mat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.mat,'callback','filname');


% --------------------------------------------------------------------
function txt_Callback(hObject, eventdata, handles)
% hObject    handle to txt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.txt,'callback','filname');



% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 global t;
 global channelnumber;
 global finame;
 global dataname;
 global myname;
 global dataname;
 global filname;
 global T1;
 t=str2num(get(handles.edit3,'string'));
 finame=filname.Data;
 set(handles.pushbutton1,'userdata',finame);
 axes(handles.axes1);
 T=t:1/100:1000+t;
 T1=T';
 [r,c]=size(T1);
 Data1=finame(t*100+1:r+t*100);
 fi=plot(T1,Data1); 
 set(handles.pushbutton5,'userdata',t*100);
 set(handles.pushbutton3,'userdata',50);
 grid on
 set(handles.axes1,'color','yellow','xlim',[t 1000+t],'ylim',[-100 100]);
 set(fi,'color','red'); 



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
t1=str2num(get(handles.edit3,'string'));
t2=str2num(get(handles.edit5,'string'));
for channel=25:32
    shujuname=sprintf('CH%d.mat',channel);         %创建由格式控制的指定的字符串
    alldata=load(shujuname);
    curdata=alldata.Data(t1*100:t2*100);
    maxdata=max(curdata);
    dataA(channel-24)=maxdata;
    mindata=min(curdata);
    dataB(channel-24)=mindata;
   end
filename=get(handles.edit1,'string');
fid=fopen(filename,'a');   %以附加的形式打开文件filename;
aa=fprintf(fid,'%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n',dataA); %把格式数据写到文件里
bb=fprintf(fid,'%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n',dataB);
fclose(fid);



% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)%放大
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
              aa=get(handles.pushbutton1,'userdata');
              t=str2num(get(handles.edit3,'string'));
              step=get(handles.pushbutton3,'userdata');
              T=t+step:1/100:t+3*step;
              T1=T';
              [r c]=size(T1);
              yy=aa((t+step)*100+1:r+(t+step)*100);        
              draw=plot(T1,yy);
              set(handles.axes1,'color','yellow','xlim',[t+step t+3*step],'ylim',[-100 100]);
              set(draw,'color','red'); 
              set(handles.pushbutton3,'userdata',step/2);
               


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)%缩小
% hObject    handle to pushbutton4 (see GCBO)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -