GCBSH gets the handles for the currently selected blocks. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GCBSH gets the handles for the currently selected blocks. Usage: >> gcbsh >> h = gcbsh M Hewitson 29-08-07 $Id: gcbsh.html,v 1.12 2008/03/31 10:27:31 hewitson Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = gcbsh() 0002 0003 % GCBSH gets the handles for the currently selected blocks. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % GCBSH gets the handles for the currently selected blocks. 0008 % 0009 % Usage: >> gcbsh 0010 % >> h = gcbsh 0011 % 0012 % M Hewitson 29-08-07 0013 % 0014 % $Id: gcbsh.html,v 1.12 2008/03/31 10:27:31 hewitson Exp $ 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 h = []; 0019 0020 blks = find_system(gcs, 'SearchDepth',1, 'LookUnderMasks', 'all', 'Type', 'block'); 0021 hs = get_param(blks, 'Handle'); 0022 0023 % get selected blocks 0024 for j=1:length(hs) 0025 if get_param(gcs, 'Handle') ~= hs{j} 0026 if strcmp(get(hs{j}, 'Selected'), 'on') 0027 h = [h hs{j}]; 0028 end 0029 end 0030 end 0031 0032 if nargout == 0 0033 disp(h.') 0034 elseif nargout == 1 0035 varargout{1} = h.'; 0036 else 0037 error('### Too many output arguments') 0038 end