资源简介
Matlab的GUI的slider滑动条和edit动态文本框一起调整某个参数例程。配合csdn博客教程

代码片段和文件信息
function varargout = untitled1(varargin)
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘ mfilename ...
‘gui_Singleton‘ gui_Singleton ...
‘gui_OpeningFcn‘ @untitled1_OpeningFcn ...
‘gui_OutputFcn‘ @untitled1_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 untitled1 is made visible.
function untitled1_OpeningFcn(hobject eventdata handles varargin)
% Choose default command line output for untitled1
handles.output = hobject;
% Update handles structure
guidata(hobject handles);
% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled1_OutputFcn(hobject eventdata handles)
global a ;
global x ;
a=1;
x = 0:10;
y = a*x;
plot(xy);
ylim([0100]);
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hobject eventdata handles)
global a;
global x;
input = str2num(get(hobject‘String‘));
if input<=10
a = input;
y = a*x;
plot(xy);
ylim([0100]);
set(handles.slider1‘Value‘a); %使得滑动条和输入框保持一致
else
msgbox(‘invalid value‘‘warning‘‘warn‘); %error message window
end
% 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)
% Hint: edit controls usually have a white background on Windows.
set(hobject‘string‘‘1‘); %设置初始值为1
if ispc && isequal(get(hobject‘BackgroundColor‘) get(0‘defaultUicontrolBackgroundColor‘))
set(hobject‘BackgroundColor‘‘white‘);
end
% --- Executes on slider movement.
function slider1_Callback(hobject eventdata handles)
global a;
global x;
input = get(hobject‘Value‘);
a = input;
y = a*x;
plot(xy);
ylim([0100]);
set(handles.edit1‘String‘num2str(a)); %使得输入框edit1和滑动条保持一致
% Hints: get(hobject‘Value‘) returns position of slider
% get(hobject‘Min‘) and get(hobject‘Max‘) to determine range of slider
% --- Executes during object creation after setting all properties.
function slider1_CreateFcn(hobject eventdata handles)
% Hint: slider controls usually have a light gray background.
set(hobject‘Value‘1); %设置初始值为1
if isequal(get(hobject‘BackgroundColor‘) get(0‘defaultUicontrolBackgroundColor‘))
set(hobject‘BackgroundColor‘[.9 .9 .9]);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 451357 2020-05-09 21:08 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\GIF.gif
文件 517706 2020-05-09 21:16 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\GIF2.gif
文件 166802 2020-05-09 22:42 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\GIF3.gif
文件 23877 2020-05-09 22:30 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\unti
文件 2996 2020-05-09 22:34 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\unti
目录 0 2020-05-09 22:45 matlab的gui的slider滑动条和可编辑文本框动态调整某个参数\
- 上一篇:matlab串口通信官方教程
- 下一篇:802.11a物理层链路
相关资源
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
- 神经网络分类matlab程序
- matlab正弦信号发生器的设计
- matlab程序用Hopfield网络解决TSP
- 实例matlab 编程100个常用程序
- 用MATLAB(BPSK仿真 直接扩频)
- 最小二乘法曲线拟合(MATLAB)
评论
共有 条评论