function varargout = matlab_GUI8(varargin)
% MATLAB_GUI8 MATLAB code for matlab_GUI8.fig
% MATLAB_GUI8, by itself, creates a new MATLAB_GUI8 or raises the existing
% singleton*.
%
% H = MATLAB_GUI8 returns the handle to a new MATLAB_GUI8 or the handle to
% the existing singleton*.
%
% MATLAB_GUI8('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MATLAB_GUI8.M with the given input arguments.
%
% MATLAB_GUI8('Property','Value',...) creates a new MATLAB_GUI8 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before matlab_GUI8_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to matlab_GUI8_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 matlab_GUI8
% Last Modified by GUIDE v2.5 07-Sep-2011 17:14:25
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @matlab_GUI8_OpeningFcn, ...
'gui_OutputFcn', @matlab_GUI8_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 matlab_GUI8 is made visible.
function matlab_GUI8_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 matlab_GUI8 (see VARARGIN)
% Choose default command line output for matlab_GUI8
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes matlab_GUI8 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = matlab_GUI8_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 selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (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
%当listbox刚被创建的时候,定义四组参数值
t=0:0.01:2*pi;
canshu1=t;
canshu2=sin(t);
canshu3=cos(t);
canshu4=sin(t)+cos(t);
CS={canshu1,canshu2,canshu3,canshu4}; %塞尔矩阵
handles.CS=CS; %保存CS中的数值
guidata(hObject,handles)%对handles结构体进行更新和保存
% --- 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)
selected_index=get(handles.listbox1,'value'); %listbox中的哪一行被选中
str=get(handles.listbox1,'string'); %获取listbox的string,保存在str(塞尔矩阵)中,value中的数值对应于listbox中的字符串
set(handles.edit1,'string',str{selected_index});%str为塞尔矩阵,用大括号表示
x=handles.CS{selected_index};
handles.x=x;
guidata(hObject,handles)
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)
selected_index=get(handles.listbox1,'value'); %listbox中的哪一行被选中
str=get(handles.listbox1,'string'); %获取listbox的string,保存在str(塞尔矩阵)中,value中的数值对应于listbox中的字符串
set(handles.edit2,'string',str{selected_index});%str为塞尔矩阵,用大括号表示
y=handles.CS{selected_index};
handles.y=y;
guidata(hObject,handles)
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 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)
axes(handles.axes1)
plot(handles.x,handles.y)
axis equal
MATLAB GUI选择参数绘制曲线
5星 · 超过95%的资源 需积分: 50 195 浏览量
2011-09-11
15:30:37
上传
评论 5
收藏 10KB ZIP 举报
wanxingcundeweizai
- 粉丝: 2
- 资源: 4
最新资源
- 校园帮项目,毕业设计/课程设计/javaWeb/SSM
- C++ plotting library,matplotlib-cpp-master.zip
- 案例源码matplotlib-examples-master.zip
- 基于JavaScript 实现的KMP 算法
- 基于C++实现二叉树的创建,遍历,添加,查找与删除
- 基于C语言实现二叉树的基本操作
- 毕业设计基于STM32的测量温度与压力的数据处理设计C语言完整源码+论文.zip
- 基于MATLAB的PCA算法人脸识别项目源码+GUI界面+说明文档.zip
- 基于STM32的测量温度与压力的数据处理设计源码+论文(毕业设计).zip
- Vision Transformer 网络对不同氨气氧气浓度轨迹RAS 图像数据集的分类,包含训练权重和数据集、迁移学习
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈