Mercurial > hg > ltpda
comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_importObjs.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 ltpdv_importObjs(varargin) | |
2 % LTPDV_IMPORTOBJS import given objects to the object list | |
3 % | |
4 % M Hewitson 22-04-08 | |
5 % | |
6 % $Id: ltpdv_importObjs.m,v 1.2 2008/06/18 15:07:35 hewitson Exp $ | |
7 % | |
8 | |
9 myh = varargin{1}; | |
10 mainfig = varargin{end-1}; | |
11 oh = varargin{end}; | |
12 | |
13 % Get data | |
14 data = get(oh, 'Data'); | |
15 | |
16 % Get selected rows | |
17 rows = getappdata(mainfig, 'ImportWorkspaceSelectedRows'); | |
18 | |
19 % Do we rename to variable name? | |
20 ch = findobj(mainfig, 'Tag', 'LTPDVusevarnameChk'); | |
21 if get(ch, 'Value') | |
22 useVarname = true; | |
23 else | |
24 useVarname = false; | |
25 end | |
26 | |
27 % Data to import | |
28 idata = data(rows,:); | |
29 % Current objects | |
30 % Get each object from the workspace | |
31 for j=1:size(idata,1) | |
32 % get variable name | |
33 varname = idata{j,1}; | |
34 % get object | |
35 obj = evalin('base', varname); | |
36 if useVarname | |
37 for k=1:numel(obj) | |
38 obj(k) = obj(k).setName(varname); | |
39 end | |
40 end | |
41 % Add these objecs to the object list | |
42 for j=1:numel(obj) | |
43 objs = getappdata(mainfig, 'LTPDAobjects'); | |
44 setappdata(mainfig, 'LTPDAobjects', [objs {obj(j)}]); | |
45 end | |
46 % Refresh object list | |
47 ltpdv_refresh_object_list(mainfig); | |
48 end | |
49 | |
50 | |
51 | |
52 % END |