Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function g_browseCallback(hObject, varargin) | |
2 | |
3 global params | |
4 childpath = find_system(gcbh,'LookUnderMasks','all','BlockType','M-S-Function'); | |
5 functionName = get_param(childpath,'Tag'); | |
6 if isempty(functionName) | |
7 description = get_param(gcbh,'Description'); | |
8 funcname = findstr('functionName=',description); | |
9 if funcname | |
10 i = funcname+14; | |
11 while ~strcmp(description(i),';'), i=i+1; end | |
12 functionName = description(funcname+14:i-2); | |
13 end | |
14 end | |
15 | |
16 [meth,clas] = strtok(get_param(gcbh,'Tag'),' '); | |
17 categ = 'none'; | |
18 if strcmp(meth,'method') | |
19 clas = strtrim(clas); | |
20 infoObj = eval([clas,'.getInfo(''',functionName,''')']); | |
21 categ = infoObj.mcategory; | |
22 end | |
23 | |
24 if strcmp(categ,'Output') | |
25 [fileName,filePath] = uiputfile('*.*','Choose destination file'); | |
26 else | |
27 [fileName,filePath] = uigetfile('*.*','Choose source file'); | |
28 end | |
29 | |
30 if fileName==0 | |
31 return | |
32 else | |
33 [file , ext] = strtok(fileName,'.'); | |
34 if strcmp(ext,'.*'), fileName(end)=[]; fileName=[fileName,'dat']; end | |
35 fileName = [filePath,fileName]; | |
36 end | |
37 editFieldHandle = get(hObject,'UserData'); | |
38 set(editFieldHandle,'String',fileName); | |
39 | |
40 newValue = fileName; | |
41 params = pset(params,'FILENAME',newValue); | |
42 | |
43 set(findobj('Tag','apply'),'Enable','on'); | |
44 set(findobj('Tag','undo'),'Enable','on'); | |
45 | |
46 end |