Mercurial > hg > ltpda
comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_load_objects.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 ltpdv_load_objects(varargin) | |
2 | |
3 % Handles | |
4 myh = varargin{1}; | |
5 mainfig = varargin{end}; | |
6 | |
7 % Get filename from user | |
8 [filename, pathname] = uigetfile( ... | |
9 {'*.mat', 'MATLAB MAT Files (*.mat)'; ... | |
10 '*.xml', 'LTPDA XML Files (*.xml)'}, ... | |
11 'Select a file'); | |
12 | |
13 if isequal(filename,0) || isequal(pathname,0) | |
14 disp('Cancelled.') | |
15 else | |
16 fname = fullfile(pathname, filename); | |
17 | |
18 % split filename up | |
19 [pathstr, name, ext] = fileparts(fname); | |
20 | |
21 switch ext | |
22 case '.mat' | |
23 | |
24 obj = load(fname); | |
25 | |
26 case '.xml' | |
27 | |
28 root_node = xmlread(filename); | |
29 obj = utils.xml.xmlread(root_node); | |
30 | |
31 otherwise | |
32 error('### Unsupported file format.'); | |
33 end | |
34 end | |
35 | |
36 % Add this object to the list | |
37 objs = getappdata(mainfig, 'LTPDAobjects'); | |
38 setappdata(mainfig, 'LTPDAobjects', [objs {obj}]); | |
39 % Refresh object list | |
40 ltpdv_refresh_object_list(mainfig); | |
41 | |
42 | |
43 | |
44 % END |