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

📄 plsvsmgui.m

📁 这是国外一个PLS工具箱
💻 M
字号:
function varargout = PlsvsmGUI(varargin)
% PlsvsmGUI M-file for PlsvsmGUI.fig
%      PlsvsmGUI, by itself, creates a new PlsvsmGUI or raises the existing
%      singleton*.
%
%      H = PlsvsmGUI returns the handle to a new PlsvsmGUI or the handle to
%      the existing singleton*.
%
%      PlsvsmGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PlsvsmGUI.M with the given input arguments.
%
%      PlsvsmGUI('Property','Value',...) creates a new PlsvsmGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before PlsvsmGUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to PlsvsmGUI_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 PlsvsmGUI

% Last Modified by GUIDE v2.5 07-Apr-2006 20:43:11
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @PlsvsmGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @PlsvsmGUI_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 PlsvsmGUI is made visible.
function PlsvsmGUI_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 PlsvsmGUI (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


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



vars = evalin('base','who');
set(handles.ModelMatrix,'String',vars);

% --- Executes on selection change in ModelMatrix.
function ModelMatrix_Callback(hObject, eventdata, handles)
% hObject    handle to ModelMatrix (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 ModelMatrix contents as cell array
%        contents{get(hObject,'Value')} returns selected item from ModelMatrix


% --- Executes during object creation, after setting all properties.
function ModelMatrix_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ModelMatrix (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox 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 UpdateWorkspaces.
function UpdateWorkspaces_Callback(hObject, eventdata, handles)
% hObject    handle to UpdateWorkspaces (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

vars = evalin('base','who');
set(handles.ModelMatrix,'String',vars);

% --- Executes on button press in checkIntervals.
function checkIntervals_Callback(hObject, eventdata, handles)
% hObject    handle to checkIntervals (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 checkIntervals

if (get(handles.checkIntervals,'Value') == get(handles.checkIntervals,'min'))
    % then checkbox is not checked 
     set(handles.Intervals,'Enable', 'off')
  
else
     set(handles.Intervals,'Enable', 'on')
   
end

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


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

list_entriesModel = get(handles.ModelMatrix,'String');
index_selectedModel= get(handles.ModelMatrix,'Value');
Model = evalin('base',list_entriesModel{index_selectedModel(1)});


if (get(handles.checkIntervals,'Value') == get(handles.checkIntervals,'min'));
    % then checkbox is not checked 
     interval = 0
else
     interval = str2double(get(handles.Intervals,'String'));
   
end

no_of_int_lv = str2double(get(handles.PlsComponent,'String'));

if (get(handles.checkYvariables,'Value') == get(handles.checkYvariables,'min'));
    % then checkbox is not checked 
     y_variable = 1
else
     y_variable = str2double(get(handles.Yvariable,'String'));
   
end

%figure

plspvsm (Model,no_of_int_lv,interval,y_variable)





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


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

if (get(handles.checkYvariables,'Value') == get(handles.checkYvariables,'min'))
    % then checkbox is not checked 
     set(handles.Yvariable,'Enable', 'off')
  
else
     set(handles.Yvariable,'Enable', 'on')
   
end

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


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

list_entriesModel = get(handles.ModelMatrix,'String')
index_selectedModel= get(handles.ModelMatrix,'Value')
Model = evalin('base',list_entriesModel{index_selectedModel(1)})

intervals(Model)

⌨️ 快捷键说明

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