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

📄 dataimport.m

📁 vb开发的神经网络
💻 M
字号:
function varargout = DataImport(varargin)
% DATAIMPORT M-file for DataImport.fig
%      DATAIMPORT, by itself, creates a new DATAIMPORT or raises the existing
%      singleton*.
%
%      H = DATAIMPORT returns the handle to a new DATAIMPORT or the handle to
%      the existing singleton*.
%
%      DATAIMPORT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DATAIMPORT.M with the given input arguments.
%
%      DATAIMPORT('Property','Value',...) creates a new DATAIMPORT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before DataImport_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to DataImport_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 DataImport

% Last Modified by GUIDE v2.5 27-May-2005 21:19:44

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

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

% Update handles structure
guidata(hObject, handles);

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

% set(hObject,'OuterPosition',[116.6 8.6923 81 21.1538]);

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


% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox1


% --- Executes on button press in checkboxSet.
function checkboxSet_Callback(hObject, eventdata, handles)
% hObject    handle to checkboxSet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkboxSet
if get(hObject,'Value')==1
    set([handles.radiobuttonSet2050,handles.radiobuttonSet1580,handles.radiobuttonSet1880],...
        'Enable','on');

    set(handles.checkboxDate,'Value',0);
    set([handles.popupmenuDate,handles.btnDate],'Enable','off');

elseif get(hObject,'Value')==0
    set([handles.radiobuttonSet2050,handles.radiobuttonSet1580,handles.radiobuttonSet1880],...
        'Enable','off');

    set(handles.checkboxDate,'Value',1);
    set([handles.popupmenuDate,handles.btnDate],'Enable','on');
end

    

% --- Executes on button press in radiobuttonSet2050.
function radiobuttonSet2050_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonSet2050 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobuttonSet2050


% --- Executes on button press in radiobuttonSet1580.
function radiobuttonSet1580_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonSet1580 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobuttonSet1580


% --- Executes on button press in radiobuttonSet1880.
function radiobuttonSet1880_Callback(hObject, eventdata, handles)
% hObject    handle to radiobuttonSet1880 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobuttonSet1880


% --- Executes on button press in checkboxDate.
function checkboxDate_Callback(hObject, eventdata, handles)
% hObject    handle to checkboxDate (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkboxDate
if get(hObject,'Value')==1
    set([handles.radiobuttonSet2050,handles.radiobuttonSet1580,handles.radiobuttonSet1880],...
        'Enable','off');

    set(handles.checkboxSet,'Value',0);
    set([handles.popupmenuDate,handles.btnDate],'Enable','on');

elseif get(hObject,'Value')==0
    set([handles.radiobuttonSet2050,handles.radiobuttonSet1580,handles.radiobuttonSet1880],...
        'Enable','on');

    set(handles.checkboxSet,'Value',1);
    set([handles.popupmenuDate,handles.btnDate],'Enable','off');
end


% --- Executes on selection change in popupmenuDate.
function popupmenuDate_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuDate (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuDate contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuDate


% --- Executes during object creation, after setting all properties.
function popupmenuDate_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuDate (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 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 btnDate.
function btnDate_Callback(hObject, eventdata, handles)
% hObject    handle to btnDate (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

f = figure('Menu','none','Toolbar','none','NumberTitle','off','Name','双击选择日期','position', [378 328 300 300]);
cal = actxcontrol('mscal.calendar', [0 0 300 300], f,{'DblClick' 'my2click'});

handles.cal=cal;
guidata(hObject,handles)

function my2click(varargin)
cal=handles.cal
DateStr=cal.Value


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

% save current path
path_pwd=pwd;

set(findobj('name','热轧温度仿真工具'),'Userdata',[]);

if get(handles.checkboxSet,'Value')==1
    % 如果按 机组 选择数据
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % 判断机组的选择,并进入各自的目录
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if get(handles.radiobuttonSet2050,'Value')==1
        path=strcat(pwd,'\data\2050\');
    end
    if get(handles.radiobuttonSet1580,'Value')==1
        path=strcat(pwd,'\data\1580\');
    end
    if get(handles.radiobuttonSet1880,'Value')==1
        path=strcat(pwd,'\data\1880\');
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 切换到相应的目录
    cd(path);


    % Import data
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    [fname,pname]=uigetfile('*.xls','选择带钢数据');%打开文件对话框
    if isequal(fname,0)
        disp('取消选择带钢')
    else
        disp(['导入带钢数据 ', fullfile(pname, fname)])
        n = 100;
        progressbar % Create figure and set starting time
        for i = 1:n
            pause(0.01) % Do something important
            progressbar(i/n) % Update figure
        end
        filename=[pname,fname];   %合并文件路径和文件名
        [btnStripImport.DataImport btnStripImport.VarName]=xlsread(filename);%读取文件内容
        btnStripImport.FileName=fname;
        btnStripImport.PathName=pname;

        % 将数据存入主界面的Userdate属性
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        set(findobj('name','热轧温度仿真工具'),'Userdata',btnStripImport);
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        close;
    end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



elseif get(handles.checkboxDate,'Value')==1 
% 如果按 日期 选择数据
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end

% back to default path
cd(path_pwd);





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

% get(gcf,'position')

⌨️ 快捷键说明

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