comparison m-toolbox/classes/@workspaceBrowser/getSelectedObjects.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % GETSELECTEDOBJECTS returns a cell-array of the objects selected in the
2 % workspace browser.
3 %
4 %
5 function objs = getSelectedObjects(wb)
6
7 vars = wb.hdl.getSelectedPaths;
8
9 objs = {};
10 for kk=1:numel(vars)
11 var = char(vars(kk));
12 var = strrep(var, 'workspace,', '');
13 var = strrep(var, '[', '');
14 var = strrep(var, ']', '');
15 var = strrep(var, ' ', '');
16 var = strrep(var, ',', '.');
17
18 try
19 % get the variable
20 cmd = sprintf('obj = evalin(''base'', ''%s'');', var);
21 eval(cmd);
22 objs = [objs {obj}];
23 catch
24 error('### variable ''%s'' not available in the workspace. Refresh the browser.', var);
25 end
26 end
27
28 end