Mercurial > hg > ltpda
comparison m-toolbox/classes/@constructor/buildObj.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 function buildObj(varargin) | |
2 | |
3 mainfig = varargin{end}; | |
4 | |
5 % get object name | |
6 varh = findobj(mainfig.handle, 'Tag', 'VariableTxt'); | |
7 varname = get(varh, 'String'); | |
8 | |
9 % get base workspace variables | |
10 ws_vars = evalin('base','who'); | |
11 | |
12 % check if this one is there or not | |
13 if ismember(varname, ws_vars) | |
14 j = 1; | |
15 vname = varname; | |
16 while ismember(vname, ws_vars) | |
17 vname = sprintf('%s_%03d', varname, j); | |
18 j = j + 1; | |
19 end | |
20 else | |
21 vname = varname; | |
22 end | |
23 | |
24 disp(sprintf('** exporting to %s', vname)); | |
25 | |
26 % get constructor string | |
27 h = findobj(mainfig.handle, 'Tag', 'ConstructorDisplay'); | |
28 cstr = get(h, 'String'); | |
29 | |
30 cmd = sprintf('%s = %s;', vname, cstr); | |
31 evalin('base', cmd); | |
32 | |
33 | |
34 | |
35 end |