Mercurial > hg > ltpda
diff m-toolbox/m/gui/gltpda/g_browseCallback.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/gltpda/g_browseCallback.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,46 @@ +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 \ No newline at end of file