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

📄 dimaidong.m

📁 打开一段波形数据
💻 M
字号:
function varargout = dimaidong(varargin)
% DIMAIDONG M-file for dimaidong.fig
%      DIMAIDONG, by itself, creates a new DIMAIDONG or raises the existing
%      singleton*.
%
%      H = DIMAIDONG returns the handle to a new DIMAIDONG or the handle to
%      the existing singleton*.
%
%      DIMAIDONG('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DIMAIDONG.M with the given input arguments.
%
%      DIMAIDONG('Property','Value',...) creates a new DIMAIDONG or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before dimaidong_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to dimaidong_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

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help dimaidong

% Last Modified by GUIDE v2.5 26-Apr-2007 10:40:28

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @dimaidong_OpeningFcn, ...
                   'gui_OutputFcn',  @dimaidong_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 dimaidong is made visible.
function dimaidong_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 dimaidong (see VARARGIN)




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

% Update handles structure
guidata(hObject, handles); % Save the updated structure保存更新的结构

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


% --- Outputs from this function are returned to the command line.
function varargout = dimaidong_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 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)

[FileName,PathName] = uigetfile({'*.sts','INV data Files (*.sts)'},'Select the stm-file');
if ~isequal(FileName, 0)
    fnc=double(FileName);
    for i=1:max(size(fnc))
        if(fnc(i:i)==46)
            fnc(i+1:i+1)=116;fnc(i+2:i+2)=115;fnc(i+3:i+3)=112;
        end
    end
    filename=char(fnc);
    
    guidata(hObject, handles);
    file1=strcat(PathName,FileName);file2=strcat(PathName,filename);
    fid1=fopen(file1,'r');fid2=fopen(file2,'r');
    handles.INVdata=fread(fid1,inf,'ushort')/2^16*10-5;
    handles.INVtsp=fread(fid2,inf,'char');
    j=1;  
        while(handles.INVtsp(j:j)>44)
            
            j=j+1;
           
        end
        while(handles.INVtsp(j-1:j-1)>46)
            k=j-1;
        end
        k
                
           % handles.sample=str2num(strcat(char(handles.INVtsp(1:j))));
           
           
    handles.t=(1:size(handles.INVdata))/handles.sample;
    guidata(hObject, handles);
end
   axes(handles.axes1);
   plot(handles.t,handles.INVdata);
   set(gca,'FontSize',10);
   
   %axis([0 max(handles.t) str2num(get(handles.ymax,'String')) str2num(get(handles.ymax,'String'))]);
   axis([0 max(handles.t) 0-str2num(get(handles.ymax,'String')) str2num(get(handles.ymax,'String'))]);
   xlabel('时间(ms)','FontSize',10);
   ylabel('幅值(V)','FontSize',10);
   
   
% --------------------------------------------------------------------
function print_Callback(hObject, eventdata, handles)
% hObject    handle to print (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)


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


% --- Executes during object creation, after setting all properties.
function ymax_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ymax (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





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


% --- Executes during object creation, after setting all properties.
function samples_CreateFcn(hObject, eventdata, handles)
% hObject    handle to samples (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


⌨️ 快捷键说明

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