source: trunk/src/find_imadoc.m @ 644

Last change on this file since 644 was 507, checked in by sommeria, 9 years ago

various improvments and corrections
dtatatree_browser tested

File size: 1.4 KB
[469]1% 'find_imadoc': find the ImaDoc xml file associated with a given input file
2% take into account the old conventions
4% function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt)
7% XmlFileName: name of the xml file, ='' if none is found
10% RootPath,SubDir,RootFile,FileExt, as given from the input file name by fileparts_uvmat
11function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt)
12SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
13XmlFileName=[fullfile(RootPath,SubDirBase) '.xml'];%new convention: xml at the level of the image folder
14if ~exist(XmlFileName,'file')
[507]15    XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.xml']; % old convention: xml inside the image folder, case of images or new civ files
[469]16    if ~exist(XmlFileName,'file')
[507]17        XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.civ']; % very old convention: .civ file
18        if ~exist(XmlFileName,'file') && strcmp(FileExt,'.nc')
19            XmlFileName=[fullfile(RootPath,RootFile) '.xml'] ; % old convention: xml inside the image folder, old civ file opened
20            if ~exist(XmlFileName,'file')
21                XmlFileName=[fullfile(RootPath,RootFile) '.civ']; % very old convention: .civ file
22            end
[469]23        end
24    end
26if ~exist(XmlFileName,'file')
27    XmlFileName='';
Note: See TracBrowser for help on using the repository browser.