当前位置:网站首页>Matlab GUI --- animation demonstration of singleselectionlistbox
Matlab GUI --- animation demonstration of singleselectionlistbox
2022-04-21 10:57:00 【Xiaoyu 2022】

function varargout = example6_4_1(varargin)
% EXAMPLE6_4_1 MATLAB code for example6_4_1.fig
% EXAMPLE6_4_1, by itself, creates a new EXAMPLE6_4_1 or raises the existing
% singleton*.
%
% H = EXAMPLE6_4_1 returns the handle to a new EXAMPLE6_4_1 or the handle to
% the existing singleton*.
%
% EXAMPLE6_4_1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in EXAMPLE6_4_1.M with the given input arguments.
%
% EXAMPLE6_4_1('Property','Value',...) creates a new EXAMPLE6_4_1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before example6_4_1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to example6_4_1_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 example6_4_1
% Last Modified by GUIDE v2.5 02-Jan-2011 03:18:42
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @example6_4_1_OpeningFcn, ...
'gui_OutputFcn', @example6_4_1_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 example6_4_1 is made visible.
function example6_4_1_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 example6_4_1 (see VARARGIN)
% Choose default command line output for example6_4_1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes example6_4_1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = example6_4_1_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;
function listbox1_Callback(hObject, eventdata, handles)
%% If you double-click the left button , And the double-click option is not in the list box on the right , Add this option to the list box on the right
if isequal(get(gcf, 'SelectionType'), 'open')
str = get(hObject, 'string'); % Get the options in the list box on the left
n = get(hObject, 'value'); % Get the index value of the current option in the left list box
strs = get(handles.listbox2, 'string'); % Get the options in the list box on the right
n2 = get(handles.listbox2, 'value'); % Get the index value of the current option in the right list box
if isempty(strs) || (~any(strcmp(str(n), strs))) % If the current option is not in the list box on the right
set(handles.listbox2, 'string', [get(handles.listbox2, 'string');...
str(n)], 'value', max(n2, 1)); % Add the current option to the list box on the right
end
end
function listbox1_CreateFcn(hObject, eventdata, handles)
% 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
function listbox2_Callback(hObject, eventdata, handles)
str = get(gcf, 'SelectionType');
if strcmp(str, 'open')
index = get(hObject, 'Value');
strDisp = get(hObject, 'String');
strDisp(index) = [];
set(hObject, 'String', strDisp, 'Value', size(strDisp, 1));
end
function listbox2_CreateFcn(hObject, eventdata, handles)
% 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
版权声明
本文为[Xiaoyu 2022]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211056175115.html
边栏推荐
- AcWing 1749. Block billboard II (classified discussion + enumeration)
- 暴力破解美团最新JVM面试题
- pgpool-II 4.3 中文手册 - 入门教程
- MySQL modifies the maximum number of connections
- You don't know parseInt?
- IoT平台如何实现业务配置中心
- Laravel Redis的使用
- Mysql 002 DDL
- P4 Tutorials---- source routing
- 【acwing】1459. Cow Gymnastics (simulation, thinking)
猜你喜欢
随机推荐
训练总结报告
Go语言错误处理
P4 Tutorials---- source routing
@Lookup
C#调用delphi dll接口问题
MySQL modifies the maximum number of connections
package.json
MySQL深入学习(三十):数据库的设计规范
Use of laravel redis
C语言中使用scanf函数时应注意的问题
P4 Tutorials---- source routing
js---call,apply,bind
pgpool-II 4.3 中文手册 - 入门教程
Convbert: improving Bert with span based dynamic revolution
Problems needing attention when using scanf function in C language
First go program
AC自动机专题训练
Suffix Array
Copyright loopholes in NFT: product design needs to consider the legal level
(坐标型动态规划)lintcode中等248 · 统计比给定整数小的数的个数

![[非线性控制理论]1_Lyapunov直接方法](/img/ad/68bceb288d40ae98b60dbb83e0b91d.png)







