view m-toolbox/classes/@constructor/buildObj.m @ 2:18e956c96a1b database-connection-manager

Add LTPDADatabaseConnectionManager implementation. Matlab code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sun, 04 Dec 2011 21:23:09 +0100
parents f0afece42f48
children
line wrap: on
line source

function buildObj(varargin)
  
  mainfig = varargin{end};
    
  % get object name
  varh = findobj(mainfig.handle, 'Tag', 'VariableTxt');
  varname = get(varh, 'String');

  % get base workspace variables
  ws_vars = evalin('base','who');
  
  % check if this one is there or not
  if ismember(varname, ws_vars)
    j = 1;
    vname = varname;
    while ismember(vname, ws_vars)
      vname = sprintf('%s_%03d', varname, j);
      j = j + 1;
    end
  else
    vname = varname;
  end
  
  disp(sprintf('** exporting to %s', vname));
  
  % get constructor string
  h = findobj(mainfig.handle, 'Tag', 'ConstructorDisplay');
  cstr = get(h, 'String');
  
  cmd = sprintf('%s = %s;', vname, cstr);
  evalin('base', cmd);
  
  
  
end