function [] = pb_call(varargin)% Callback for pushbuttonS = varargin{3}; % Get the structure.N = str2double(get(S.ed(1:2),'string')); % The numbers to operate on.VL = get(S.pp,{'str','value'}); % User's choice of operation.% Now get the string updates and perform operations.switch VL{1}{VL{2}} % User's string choice from popup.
尤其是那个S = varargin{3};
varargin是代表输入的变数量参数(输入参数个数可以任意),但必须作为最后一个参数出现,它是一个cell型数据function [] = pb_call(varargin)% Callback for pushbuttonS = varargin{3}; % 取第三个输入参数,从下面的语句可以看出,第三个参数,是个GUI中的handles结构体N = str2double(get(S.ed(1:2),'string')); % 获取对应ed控件的字符串VL = get(S.pp,{'str','value'}); % 获取tag为pp的控件的字符串和值% Now get the string updates and perform operations.switch VL{1}{VL{2}} % 这个语句没有写完,是用来判断选择的% by dynamic of Matlab技术论坛% see also http://www.matlabsky.com% contact me matlabsky@gmail.com% 2009-08-16 13:49:33 |
|