利用结构体传递多个参数 matlab
来源:互联网 发布:php 数据库 主机配置 编辑:程序博客网 时间:2024/04/29 03:23
'units','pix',...
'position',[90 20 200 20],...
'backgroundcolor','w',...
'callback',{@ed_call,S});
function [] = ed_call(varargin)
% Closes the dialog when user presses return.
[h,S] = varargin{[1,3]}; % Get calling handle and structure.
close(S.fh)
end
% --- Outputs from this function are returned to the command line.function varargout = mygui_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)
varargin传递参数包括:
h是uicontrol句柄,相当于GUI中hobject;
S是自定义传递句柄,相当于GUI中handles;
隐藏的是事件句柄,相当于GUI中eventdata.
一个调用了"keypressbutton"eventdata的例子
function [] = GUI_15()
% Demonstrate an edit text which has copyable but unchangeable text.
% Also creates a pushbutton which will print the contents of the
% editbox to the command line.
%
% Suggested exercise: Notice that the text can be cut (as well as copied).
% Alter the keypressfcn to eliminate this.
%
% Author: Matt Fig
% Date: 7/15/2009
S.fh = figure('units','pixels',...
'position',[300 300 400 120],...
'menubar','none',...
'name','GUI_15',...
'numbertitle','off',...
'resize','off');
S.ed = uicontrol('style','edit',...
'unit','pix',...
'position',[30 70 340 30],...
'string','This text can be copied but not changed');
S.pb = uicontrol('style','push',...
'unit','pix',...
'position',[30 30 340 30],...
'string','Print to screen');
set([S.ed,S.pb],{'callback'},{{@ed_call,S};{@pb_call,S}}) % Set callbacks.
set(S.ed,'keypressfcn',{@ed_kpfcn,S}) % set keypressfcn.
function [] = pb_call(varargin)
% callback for pushbutton
S = varargin{3}; % Get the structure.
disp(get(S.ed,'string')) % Print to the command line.
function [] = ed_call(varargin)
% Callback for edit
S = varargin{3}; % Get the structure.
set (S.ed,'string','This text can be copied but not changed');
function [] = ed_kpfcn(varargin)
% Keypressfcn for edit
[K,S] = varargin{[2 3]};
if isempty(K.Modifier)
uicontrol(S.pb)
set (S.ed,'string','This text can be copied but not changed');
elseif ~strcmp(K.Key,'c') && ~strcmp(K.Modifier{1},'control')
uicontrol(S.pb)
set (S.ed,'string','This text can be copied but not changed');
end
- 利用结构体传递多个参数 matlab
- websocket 利用json 传递多个参数
- unity中利用sentmessage发送消息传递多个参数
- JNI 传递结构体参数
- JNI 传递结构体参数
- 结构体作为参数传递
- JNI 传递结构体参数
- 线程传递结构体参数
- JNI 传递结构体参数
- [转载+原创] matlab对个界面之间参数的传递
- showModalDialog传递多个参数
- 多个参数的传递
- HyperLink传递多个参数
- setTimeout传递多个参数
- LinkButton 传递多个参数
- javascript传递多个参数
- ibatis 传递多个参数
- Extjs 多个参数传递
- 菜鸟入门-自己学linux的总结
- playBackgroundMusic and playEffect crash
- django-->python web framework (小菜鸟篇)
- “作为函数参数的二维数组”即“怎么给函数传二维数组的指针”
- Android开发一些事项及Eclipse使用
- 利用结构体传递多个参数 matlab
- 如何配置 SQL Server 2005 以允许远程连接
- 在Windows环境下基于VC6.0的CppUnit使用
- 2012-01-03
- 基于hash表的文件字符串替换
- iphone开发资源汇总
- 队列 - C语言实现(摘自数据结构与算法分析 C语言描述)
- DMA基础学习一
- java NIO