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

📄 plot3dgenericgui.m

📁 这是国外一个PLS工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
function MyMatrix_Callback(hObject, eventdata, handles)
% hObject    handle to MyMatrix (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 MyMatrix contents as cell array
%        contents{get(hObject,'Value')} returns selected item from MyMatrix


% --- Executes during object creation, after setting all properties.
function MyMatrix_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MyMatrix (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 selection change in MyClasses.
function MyClasses_Callback(hObject, eventdata, handles)
% hObject    handle to MyClasses (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 MyClasses contents as cell array
%        contents{get(hObject,'Value')} returns selected item from MyClasses


% --- Executes during object creation, after setting all properties.
function MyClasses_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MyClasses (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 selection change in listbox3.
function listbox3_Callback(hObject, eventdata, handles)
% hObject    handle to listbox3 (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 listbox3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox3


% --- Executes during object creation, after setting all properties.
function listbox3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox3 (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 ClassesCheck.
function ClassesCheck_Callback(hObject, eventdata, handles)
% hObject    handle to ClassesCheck (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 ClassesCheck
if (get(handles.ClassesCheck,'Value') == get(handles.ClassesCheck,'Max'))
    % then checkbox is checked-take approriate action
     set(handles.MyClasses,'Enable', 'on')
   
else
     set(handles.MyClasses,'Enable', 'off')
        
end

% --- Executes on button press in NamesCheck.
function NamesCheck_Callback(hObject, eventdata, handles)

if (get(handles.NamesCheck,'Value') == get(handles.NamesCheck,'Max'))
    % then checkbox is checked-take approriate action
     set(handles.MyNames,'Enable', 'on')
   
else
     set(handles.MyNames,'Enable', 'off')
        
end
% hObject    handle to NamesCheck (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 NamesCheck





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


% --- Executes during object creation, after setting all properties.
function YAxis_CreateFcn(hObject, eventdata, handles)
% hObject    handle to YAxis (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 XLabel_Callback(hObject, eventdata, handles)
% hObject    handle to XLabel (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 XLabel as text
%        str2double(get(hObject,'String')) returns contents of XLabel as a double


% --- Executes during object creation, after setting all properties.
function XLabel_CreateFcn(hObject, eventdata, handles)
% hObject    handle to XLabel (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 XExpansion_Callback(hObject, eventdata, handles)
% hObject    handle to XExpansion (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 XExpansion as text
%        str2double(get(hObject,'String')) returns contents of XExpansion as a double


% --- Executes during object creation, after setting all properties.
function XExpansion_CreateFcn(hObject, eventdata, handles)
% hObject    handle to XExpansion (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 YExpansion_Callback(hObject, eventdata, handles)
% hObject    handle to YExpansion (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 YExpansion as text
%        str2double(get(hObject,'String')) returns contents of YExpansion as a double


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


v1=str2double(get(handles.XAxis,'String'))
v2=str2double(get(handles.YAxis,'String'))
v3=str2double(get(handles.ZAxis,'String'))
hl=get(handles.XLabel,'String')
vl=get(handles.YLabel,'String')
zl=get(handles.ZLabel,'String')
tt=get(handles.Title,'String')
esp1=str2double(get(handles.XExpansion,'String'))
esp2=str2double(get(handles.YExpansion,'String'))
esp3=str2double(get(handles.YExpansion,'String'))
listMyMatrix = get(handles.MyMatrix,'String');
indexMyMatrix = get(handles.MyMatrix,'Value');
MyMatrix = evalin('base',listMyMatrix{indexMyMatrix(1)});

listMyNames = get(handles.MyNames,'String');
indexMyNames = get(handles.MyNames,'Value');
MyNames = evalin('base',listMyNames{indexMyNames(1)});

figure
h=scatter3(MyMatrix(:,v1),MyMatrix(:,v2),MyMatrix(:,v3));
  grid on

set(gca,'XLim',[(min(MyMatrix(:,v1))-(0.01*esp1*(max(MyMatrix(:,v1))-min(MyMatrix(:,v1))))) (max(MyMatrix(:,v1))+(0.01*esp1*(max(MyMatrix(:,v1))-min(MyMatrix(:,v1)))))]);
set(gca,'YLim',[(min(MyMatrix(:,v2))-(0.01*esp2*(max(MyMatrix(:,v2))-min(MyMatrix(:,v2))))) (max(MyMatrix(:,v2))+(0.01*esp2*(max(MyMatrix(:,v2))-min(MyMatrix(:,v2)))))]);
set(gca,'ZLim',[(min(MyMatrix(:,v3))-(0.01*esp3*(max(MyMatrix(:,v3))-min(MyMatrix(:,v3))))) (max(MyMatrix(:,v3))+(0.01*esp3*(max(MyMatrix(:,v3))-min(MyMatrix(:,v3)))))]);
set(gca,'xlabel',text(0,0,hl));
set(gca,'ylabel',text(0,0,vl));
set(gca,'zlabel',text(0,0,zl));
title (tt)

if get(handles.EqualBox,'Value') == get(handles.EqualBox,'Max')
     axis('equal')
end


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


% --- Executes during object creation, after setting all properties.
function ZExpansion_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ZExpansion (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 ZLabel_Callback(hObject, eventdata, handles)
% hObject    handle to ZLabel (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 ZLabel as text
%        str2double(get(hObject,'String')) returns contents of ZLabel as a double


% --- Executes during object creation, after setting all properties.
function ZLabel_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ZLabel (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 ZAxis_Callback(hObject, eventdata, handles)
% hObject    handle to ZAxis (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 ZAxis as text
%        str2double(get(hObject,'String')) returns contents of ZAxis as a double


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