资源简介
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物理层链路
相关资源
- matlab串口通信官方教程
- 多普勒效应的matlab仿真程序
- 加速度计原始数据进行matlab的fft分析
- 神经网络遥感图像分类matlab
- MATLAB教室人数统计源码,GUI,论文.
- MATLAB揭秘.pdf
- 用卷积神经网络实现彩色图像的超分
- matlab src1_9 压缩包
- Matlab揭秘
-
基于Matlab_Simuli
nk的聚光太阳能电池 - 基于MATLAB的光流估计法
- matlab 2016a 完全自学一本通附件pdf
- 程序及课件-Matlab仿真及其在光学课程
- 病虫害识别系统
- 人脸超分辨率识别matlab GUI图像处理毕
- Matlab70个绘图例程
- matlab串口数据实时图形显示
- 电力系统的matlab
- MATLAB彩色图像处理
- 基于帧差法的运动目标检测程序matl
- matlab算法大全
- PCA+SVM matlab代码 测试通过
- 粒子图像测速PIVMatlab源代码
- 图片切割工具Matlab实现
- matlab动态显示ecg心电信号
- MATLAB多方法去高斯白噪声.doc
- SURF源码(matlab版).rar
- 第二计算机语言MATLAB
- Matlab优化算法PDF
- 《MATLAB统计分析与应用:40个案例分析
评论
共有 条评论