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