view m-toolbox/m/gui/gltpda/g_browseCallback.m @ 11:9174aadb93a5 database-connection-manager

Add LTPDA Repository utility functions into utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function g_browseCallback(hObject, varargin)
   
   global params
   childpath    = find_system(gcbh,'LookUnderMasks','all','BlockType','M-S-Function');
   functionName = get_param(childpath,'Tag');
   if isempty(functionName)
      description = get_param(gcbh,'Description');
      funcname = findstr('functionName=',description);
      if funcname
         i = funcname+14;
         while ~strcmp(description(i),';'), i=i+1; end
         functionName = description(funcname+14:i-2);
      end
   end

   [meth,clas] = strtok(get_param(gcbh,'Tag'),' ');
   categ = 'none';
   if strcmp(meth,'method')
      clas = strtrim(clas);
      infoObj = eval([clas,'.getInfo(''',functionName,''')']);
      categ = infoObj.mcategory;
   end
   
   if strcmp(categ,'Output')
      [fileName,filePath] = uiputfile('*.*','Choose destination file');
   else
      [fileName,filePath] = uigetfile('*.*','Choose source file');
   end
   
   if fileName==0
      return
   else
      [file , ext] = strtok(fileName,'.');
      if strcmp(ext,'.*'), fileName(end)=[]; fileName=[fileName,'dat']; end
      fileName = [filePath,fileName];
   end
   editFieldHandle = get(hObject,'UserData');
   set(editFieldHandle,'String',fileName);
   
   newValue = fileName;
   params = pset(params,'FILENAME',newValue);
   
   set(findobj('Tag','apply'),'Enable','on');
   set(findobj('Tag','undo'),'Enable','on');
   
end