diff m-toolbox/classes/+utils/@prog/gcbsh.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@prog/gcbsh.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,38 @@
+function varargout = gcbsh()
+
+% 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.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
+% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+h = [];
+
+blks = find_system(gcs, 'SearchDepth',1, 'LookUnderMasks', 'all', 'Type', 'block');
+hs   = get_param(blks, 'Handle');
+
+% get selected blocks
+for j=1:length(hs)
+  if get_param(gcs, 'Handle') ~= hs{j}
+    if strcmp(get(hs{j}, 'Selected'), 'on')
+      h = [h hs{j}];
+    end
+  end
+end
+
+if nargout == 0
+  disp(h.')
+elseif nargout == 1
+  varargout{1} = h.';
+else
+  error('### Too many output arguments')
+end
\ No newline at end of file