Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/ltpdv/callbacks/ltpdv_importObjs.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,52 @@ +function ltpdv_importObjs(varargin) +% LTPDV_IMPORTOBJS import given objects to the object list +% +% M Hewitson 22-04-08 +% +% $Id: ltpdv_importObjs.m,v 1.2 2008/06/18 15:07:35 hewitson Exp $ +% + +myh = varargin{1}; +mainfig = varargin{end-1}; +oh = varargin{end}; + +% Get data +data = get(oh, 'Data'); + +% Get selected rows +rows = getappdata(mainfig, 'ImportWorkspaceSelectedRows'); + +% Do we rename to variable name? +ch = findobj(mainfig, 'Tag', 'LTPDVusevarnameChk'); +if get(ch, 'Value') + useVarname = true; +else + useVarname = false; +end + +% Data to import +idata = data(rows,:); +% Current objects +% Get each object from the workspace +for j=1:size(idata,1) + % get variable name + varname = idata{j,1}; + % get object + obj = evalin('base', varname); + if useVarname + for k=1:numel(obj) + obj(k) = obj(k).setName(varname); + end + end + % Add these objecs to the object list + for j=1:numel(obj) + objs = getappdata(mainfig, 'LTPDAobjects'); + setappdata(mainfig, 'LTPDAobjects', [objs {obj(j)}]); + end + % Refresh object list + ltpdv_refresh_object_list(mainfig); +end + + + +% END \ No newline at end of file