- Timestamp:
- Feb 7, 2026, 9:25:13 PM (2 weeks ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
uvmat.m (modified) (13 diffs)
-
xml2struct.m (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1191 r1192 1797 1797 1798 1798 %------------------------------------------------------------------------ 1799 function MenuMask_Callback(hObject, eventdata, handles) 1800 %------------------------------------------------------------------------ 1801 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 1802 ListObj=UvData.ProjObject; 1803 select=zeros(1,numel(ListObj)); 1804 for iobj=1:numel(ListObj); 1805 if strcmp(ListObj{iobj}.ProjMode,'mask_inside')||strcmp(ListObj{iobj}.ProjMode,'mask_outside') 1806 select(iobj)=1; 1807 end 1808 end 1809 val=find(select); 1810 if isempty(val) 1811 msgbox_uvmat('ERROR','polygons must be first created by Projection object/mask polygon in the menu bar'); 1812 return 1813 else 1814 set(handles.ListObject,'Value',val); 1815 flag=1; 1816 if ~isfield(UvData.Field,'A') 1817 msgbox_uvmat('ERROR','an image needs to be opened to set the mask size'); 1818 return 1819 end 1820 npx=size(UvData.Field.A,2); 1821 npy=size(UvData.Field.A,1); 1822 xi=0.5:npx-0.5; 1823 yi=0.5:npy-0.5; 1824 [Xi,Yi]=meshgrid(xi,yi); 1825 for iobj=1:length(UvData.ProjObject) 1826 ObjectData=UvData.ProjObject{iobj}; 1827 if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')); 1828 flagobj=1; 1829 testphys=0; %coordinates in pixels by default 1830 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 1831 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 1832 Calib=UvData.XmlData{1}.GeometryCalib; 1833 testphys=1; 1799 function MenuMask_Callback(hObject, eventdata, handles) 1800 %------------------------------------------------------------------------ 1801 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 1802 ListObj=UvData.ProjObject; 1803 select=zeros(1,numel(ListObj)); 1804 for iobj=1:numel(ListObj); 1805 if strcmp(ListObj{iobj}.ProjMode,'mask_inside')||strcmp(ListObj{iobj}.ProjMode,'mask_outside') 1806 select(iobj)=1; 1807 end 1808 end 1809 val=find(select); 1810 if isempty(val) 1811 msgbox_uvmat('ERROR','polygons must be first created by Projection object/mask polygon in the menu bar'); 1812 return 1813 else 1814 set(handles.ListObject,'Value',val); 1815 flag=1; 1816 if ~isfield(UvData.Field,'A') 1817 msgbox_uvmat('ERROR','an image needs to be opened to set the mask size'); 1818 return 1819 end 1820 npx=size(UvData.Field.A,2); 1821 npy=size(UvData.Field.A,1); 1822 xi=0.5:npx-0.5; 1823 yi=0.5:npy-0.5; 1824 [Xi,Yi]=meshgrid(xi,yi); 1825 for iobj=1:length(UvData.ProjObject) 1826 ObjectData=UvData.ProjObject{iobj}; 1827 if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')); 1828 flagobj=1; 1829 testphys=0; %coordinates in pixels by default 1830 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 1831 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 1832 Calib=UvData.XmlData{1}.GeometryCalib; 1833 testphys=1; 1834 end 1835 end 1836 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type') 1837 if isequal(ObjectData.Type,'polygon') 1838 X=ObjectData.Coord(:,1); 1839 Y=ObjectData.Coord(:,2); 1840 if testphys 1841 pos=[X Y zeros(size(X))]; 1842 if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3 1843 if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0]) 1844 om=norm(Calib.SliceAngle);%norm of rotation angle in radians 1845 OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis 1846 cos_om=cos(pi*om/180); 1847 sin_om=sin(pi*om/180); 1848 pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis; 1849 end 1850 pos(:,1)=pos(:,1)+Calib.SliceCoord(1); 1851 pos(:,2)=pos(:,2)+Calib.SliceCoord(2); 1852 pos(:,3)=pos(:,3)+Calib.SliceCoord(3); 1853 end 1854 [X,Y]=px_XYZ(Calib,Slice,pos(:,1),pos(:,2),pos(:,3)); 1855 end 1856 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 1857 elseif isequal(ObjectData.Type,'ellipse') 1858 if testphys 1859 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1860 end 1861 RangeX=max(ObjectData.RangeX); 1862 RangeY=max(ObjectData.RangeY); 1863 X2Max=RangeX*RangeX; 1864 Y2Max=RangeY*RangeY; 1865 distX=(Xi-ObjectData.Coord(1,1)); 1866 distY=(Yi-ObjectData.Coord(1,2)); 1867 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1; 1868 elseif isequal(ObjectData.Type,'rectangle') 1869 if testphys 1870 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1871 end 1872 distX=abs(Xi-ObjectData.Coord(1,1)); 1873 distY=abs(Yi-ObjectData.Coord(1,2)); 1874 flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY); 1875 end 1876 if isequal(ObjectData.ProjMode,'mask_outside') 1877 flagobj=~flagobj; 1878 end 1879 flag=flag & flagobj; 1880 end 1834 1881 end 1835 1882 end 1836 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type') 1837 if isequal(ObjectData.Type,'polygon') 1838 X=ObjectData.Coord(:,1); 1839 Y=ObjectData.Coord(:,2); 1840 if testphys 1841 pos=[X Y zeros(size(X))]; 1842 if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3 1843 if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0]) 1844 om=norm(Calib.SliceAngle);%norm of rotation angle in radians 1845 OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis 1846 cos_om=cos(pi*om/180); 1847 sin_om=sin(pi*om/180); 1848 pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis; 1849 end 1850 pos(:,1)=pos(:,1)+Calib.SliceCoord(1); 1851 pos(:,2)=pos(:,2)+Calib.SliceCoord(2); 1852 pos(:,3)=pos(:,3)+Calib.SliceCoord(3); 1853 end 1854 [X,Y]=px_XYZ(Calib,Slice,pos(:,1),pos(:,2),pos(:,3)); 1883 %mask name 1884 RootPath=get(handles.RootPath,'String'); 1885 SubDir=get(handles.SubDir,'String'); 1886 RootFile=get(handles.RootFile,'String'); 1887 if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\')) 1888 RootFile(1)=[]; 1889 end 1890 list=get(handles.masklevel,'String'); 1891 masknumber=num2str(length(list)); 1892 maskindex=get(handles.masklevel,'Value'); 1893 mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex); 1894 imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200) 1895 imflag=flipdim(imflag,1); 1896 1897 %display the mask 1898 hfigmask=figure; 1899 set(hfigmask,'Name','mask image') 1900 vec=linspace(0,1,256);%define a linear greyscale colormap 1901 map=[vec' vec' vec']; 1902 colormap(map) 1903 image(imflag); 1904 answer=msgbox_uvmat('INPUT_TXT','mask file name:', mask_name); 1905 if ~strcmp(answer,'Cancel') 1906 mask_dir=fileparts(answer); 1907 if ~exist(mask_dir,'dir') 1908 [success,msg]=mkdir(mask_dir); 1909 if success==0 1910 msgbox_uvmat('ERROR',['cannot create ' mask_dir ': ' msg]);%error message for directory creation 1911 return 1855 1912 end 1856 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 1857 elseif isequal(ObjectData.Type,'ellipse') 1858 if testphys 1859 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1913 [success,msg] = fileattrib(mask_dir,'+w','g','s');% allow writing access for the group of users, recursively in the folder 1914 if success==0 1915 msgbox_uvmat('WARNING',{['unable to set group write access to ' mask_dir ':']; msg});%error message for directory creation 1860 1916 end 1861 RangeX=max(ObjectData.RangeX);1862 RangeY=max(ObjectData.RangeY);1863 X2Max=RangeX*RangeX;1864 Y2Max=RangeY*RangeY;1865 distX=(Xi-ObjectData.Coord(1,1));1866 distY=(Yi-ObjectData.Coord(1,2));1867 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1;1868 elseif isequal(ObjectData.Type,'rectangle')1869 if testphys1870 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys1871 end1872 distX=abs(Xi-ObjectData.Coord(1,1));1873 distY=abs(Yi-ObjectData.Coord(1,2));1874 flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY);1875 1917 end 1876 if isequal(ObjectData.ProjMode,'mask_outside') 1877 flagobj=~flagobj; 1918 try 1919 imwrite(imflag,answer,'BitDepth',8); 1920 catch ME 1921 msgbox_uvmat('ERROR',ME.message) 1878 1922 end 1879 flag=flag & flagobj; 1880 end 1881 end 1882 end 1883 %mask name 1884 RootPath=get(handles.RootPath,'String'); 1885 SubDir=get(handles.SubDir,'String'); 1886 RootFile=get(handles.RootFile,'String'); 1887 if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\')) 1888 RootFile(1)=[]; 1889 end 1890 list=get(handles.masklevel,'String'); 1891 masknumber=num2str(length(list)); 1892 maskindex=get(handles.masklevel,'Value'); 1893 mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex); 1894 imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200) 1895 imflag=flipdim(imflag,1); 1896 1897 %display the mask 1898 hfigmask=figure; 1899 set(hfigmask,'Name','mask image') 1900 vec=linspace(0,1,256);%define a linear greyscale colormap 1901 map=[vec' vec' vec']; 1902 colormap(map) 1903 image(imflag); 1904 answer=msgbox_uvmat('INPUT_TXT','mask file name:', mask_name); 1905 if ~strcmp(answer,'Cancel') 1906 mask_dir=fileparts(answer); 1907 if ~exist(mask_dir,'dir') 1908 [success,msg]=mkdir(mask_dir); 1909 if success==0 1910 msgbox_uvmat('ERROR',['cannot create ' mask_dir ': ' msg]);%error message for directory creation 1911 return 1912 end 1913 [success,msg] = fileattrib(mask_dir,'+w','g','s');% allow writing access for the group of users, recursively in the folder 1914 if success==0 1915 msgbox_uvmat('WARNING',{['unable to set group write access to ' mask_dir ':']; msg});%error message for directory creation 1916 end 1917 end 1918 try 1919 imwrite(imflag,answer,'BitDepth',8); 1920 catch ME 1921 msgbox_uvmat('ERROR',ME.message) 1922 end 1923 end 1924 set(handles.ListObject,'Value',1) 1925 end 1923 end 1924 set(handles.ListObject,'Value',1) 1925 end 1926 1926 1927 1927 %------------------------------------------------------------------------ … … 1947 1947 function MenuRelabelFrames_Callback(hObject, eventdata, handles) 1948 1948 1949 1950 1949 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 1951 1950 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 1952 % CheckRelabel=false;1953 1951 1954 1952 if strcmp(FileExt,'.seq') … … 1958 1956 end 1959 1957 [XmlData,errormsg]=imadoc2struct(XmlFile); 1960 % if isempty(XmlData) || isempty(XmlData.Time) 1961 % msgbox_uvmat('ERROR',['the timing needs to be documented in the file ' XmlFile]) 1962 % return 1963 % end 1958 1964 1959 FileInfo=get_file_info(FileName); 1965 1960 switch FileInfo.FileType … … 1969 1964 FileSeries.Convention='PCO'; 1970 1965 FileSeries.NbFramePerFile=FileInfo.NumberOfFrames; 1971 % BurstTiming.Dtj=''; 1972 % BurstTiming.NbDtj=''; 1973 % BurstTiming.Dti=''; 1974 % BurstTiming.NbDti=''; 1966 hbrowse=browse_data(fullfile(RootPath,SubDir)) 1967 [BurstTiming,errormsg] = set_param_input(ListParam,{'PCO',FileInfo.NumberOfFrames,'','','',''},[]);%fill an input panel with Matlab fct 'inputdlg' 1968 FileSeries.Convention=BurstTiming.Convention; BurstTiming=rmfield(BurstTiming,'Convention'); 1969 Camera.BurstTiming=BurstTiming; 1970 FileSeries.FileName={'im.tif';'im@0001.tif'}; 1971 FileSeries.NbFramePerFile=BurstTiming.NbFramePerFile; BurstTiming=rmfield(BurstTiming,'NbFramePerFile'); 1972 [ListPath, ListSubdir]=read_browsdata (hbrowse); 1973 NbExp=numel(ListSubdir); 1974 for iexp=1:NbExp 1975 [checkupdate,XmlFile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Camera',Camera); 1976 if ~strcmp(errormsg,'') 1977 msgbox_uvmat('ERROR',errormsg); 1978 else 1979 update_imadoc(ListPath{iexp},ListSubdir{iexp},'FileSeries',FileSeries,0);% introduce the FileSeries data in the xml file 1980 end 1981 end 1982 msgbox_uvmat('CONFIMATION',['FileSeries replicated for ' num2str(NbExp) ' experiments, open with uvmat to check']); 1983 1975 1984 end 1976 1985 case 'rdvision'%TO CHECK****** 1977 1986 check_time_rdvision(FileName,XmlData) 1978 end 1979 hbrowse=browse_data(fullfile(RootPath,SubDir)) 1980 %STR = input('OK?') 1981 [BurstTiming,errormsg] = set_param_input(ListParam,{'PCO',FileInfo.NumberOfFrames,'','','',''},[]);%fill an input panel with Matlab fct 'inputdlg' 1982 FileSeries.Convention=BurstTiming.Convention; BurstTiming=rmfield(BurstTiming,'Convention'); 1983 Camera.BurstTiming=BurstTiming; 1984 FileSeries.FileName={'im.tif';'im@0001.tif'}; 1985 FileSeries.NbFramePerFile=BurstTiming.NbFramePerFile; BurstTiming=rmfield(BurstTiming,'NbFramePerFile'); 1986 1987 % 1988 % BrowseData=guidata(hbrowse); 1989 % SourceDir=get(BrowseData.SourceDir,'String'); 1990 % ListExp=get(BrowseData.ListExperiments,'String'); 1991 % ExpIndices=get(BrowseData.ListExperiments,'Value'); 1992 % ListExp=ListExp(ExpIndices); 1993 % ListDevices=get(BrowseData.ListDevices,'String'); 1994 % DeviceIndices=get(BrowseData.ListDevices,'Value'); 1995 % ListDevices=ListDevices(DeviceIndices); 1996 % ListDataSeries=get(BrowseData.DataSeries,'String'); 1997 % DataSeriesIndices=get(BrowseData.DataSeries,'Value'); 1998 % ListDataSeries=ListDataSeries(DataSeriesIndices); 1999 % NbExp=0; % counter of the number of experiments set by the GUI browse_data 2000 % for iexp=1:numel(ListExp) 2001 % if ~isempty(regexp(ListExp{iexp},'^\+/', 'once'))% if it is a folder 2002 % for idevice=1:numel(ListDevices) 2003 % if ~isempty(regexp(ListDevices{idevice},'^\+/', 'once'))% if it is a folder 2004 % for isubdir=1:numel(ListDataSeries) 2005 % if ~isempty(regexp(ListDataSeries{isubdir},'^\+/', 'once'))% if it is a folder 2006 % lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 2007 % regexprep(ListDevices{idevice},'^\+/','')); 2008 % ldir= regexprep(ListDataSeries{isubdir},'^\+/',''); 2009 % if exist(fullfile(lpath,ldir),'dir') 2010 % NbExp=NbExp+1; 2011 % ListPath{NbExp}=lpath; 2012 % ListSubdir{NbExp}=ldir; 2013 % ExpIndex{NbExp}=iexp; 2014 % end 2015 % end 2016 % end 2017 % end 2018 % end 2019 % end 2020 % end 2021 [ListPath, ListSubdir]=read_browsdata (hbrowse); 2022 NbExp=numel(ListSubdir); 2023 for iexp=1:NbExp 2024 [checkupdate,XmlFile,errormsg]=update_imadoc(ListPath{iexp},ListSubdir{iexp},'Camera',Camera) 2025 if ~strcmp(errormsg,'') 2026 msgbox_uvmat('ERROR',errormsg); 2027 else 2028 update_imadoc(ListPath{iexp},ListSubdir{iexp},'FileSeries',FileSeries,0);% introduce the FileSeries data in the xml file 2029 if checkupdate 2030 disp([XmlFile ' updated with FileSeries']) 1987 case 'telopsIR' 1988 1989 DirContent=dir(fullfile(RootPath,SubDir)); 1990 NbFiles=0; 1991 FileSeries.Convention='telopsIR'; 1992 for ilist=1:numel(DirContent) 1993 FName=DirContent(ilist).name; 1994 if ~isempty(regexp(FName,'.hcc$', 'once'))%select only the files .hcc 1995 NbFiles=NbFiles+1; 1996 FileSeries.FileName{NbFiles,1}=FName; 1997 end 1998 end 1999 FileSeries.NbFramePerFile=FileInfo.NumberOfFrames; 2000 Camera.BurstTiming.Dti=1/FileInfo.FrameRate; 2001 Camera.BurstTiming.NbDti=NbFiles*FileInfo.NumberOfFrames-1; 2002 [checkupdate,XmlFile,errormsg]=update_imadoc(RootPath,SubDir,'Camera',Camera); 2003 if ~strcmp(errormsg,'') 2004 msgbox_uvmat('ERROR',errormsg); 2031 2005 else 2032 disp([XmlFile ' created with FileSeries']) 2033 end 2034 end 2035 end 2036 msgbox_uvmat('CONFIMATION',['FileSeries replicated for ' num2str(NbExp) ' experiments, open with uvmat to check']); 2006 [checkupdate,Xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries); 2007 msgbox_uvmat('CONFIMATION',[XmlFile ' updated with FileSeries']); 2008 end 2009 MaxIndexcell{1}=num2str(NbFiles*FileInfo.NumberOfFrames); 2010 set(handles.MaxIndex_i,'String',MaxIndexcell) 2011 end 2037 2012 2038 2013 if ~isempty(errormsg) 2039 2014 disp(errormsg) 2015 else 2016 if checkupdate 2017 disp([XmlFile ' updated with FileSeries']) 2018 else 2019 disp([XmlFile ' created with FileSeries']) 2020 end 2040 2021 end 2041 2022 … … 2472 2453 2473 2454 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% paint back button to red to indicate update is finished 2474 set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow CheckIndexing2455 set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow 2475 2456 2476 2457 … … 2487 2468 XmlFileName=find_imadoc(RootPath,SubDir);% search the appropriate ImaDoc xml file 2488 2469 [~,XmlName]=fileparts(XmlFileName); 2489 Check Indexing=false;% test for virtual indexing of frames different from the file name index, false by default2470 CheckRelabel=false;% test for virtual indexing of frames different from the file name index, false by default 2490 2471 if isempty(XmlFileName) %no ImaDoc xml file detected 2491 2472 set(handles.view_xml,'Visible','off') … … 2502 2483 if isfield(XmlData,'FileSeries') 2503 2484 if strcmp(XmlName,SubDir)% xml file directly at the level of the current data file (not up in the data tree) 2504 Check Indexing=true;% virtual indexing of frames different from the file name index2485 CheckRelabel=true;% virtual indexing of frames different from the file name index 2505 2486 else % xml file not used to document index relabeling 2506 2487 XmlData=rmfield(XmlData,'FileSeries');%desactivate file indexing option for derived file series (e.g. images.png) … … 2515 2496 end 2516 2497 end 2517 if Check Indexing2498 if CheckRelabel 2518 2499 set(handles.MenuRelabelFrames,'checked','on')% activate the relabel tool by default 2519 2500 else … … 2521 2502 end 2522 2503 XmlData.FileInfo=FileInfo; 2523 errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,Check Indexing,input_line);2504 errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckRelabel,input_line); 2524 2505 2525 2506 %-------------------------------------------------------- 2526 function errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,Check Indexing,input_line)2507 function errormsg=update_series(handles,RootPath,SubDir,FileName,XmlData,CheckRelabel,input_line) 2527 2508 errormsg=''; %default error msg 2528 2509 warntext='';%default warning message … … 2534 2515 %% get the file series 2535 2516 MovieObject=[]; 2536 if Check Indexing2517 if CheckRelabel 2537 2518 NomType='*'; 2538 2519 i1_series=[]; … … 2590 2571 TimeName='xml';%Time possibly documented by the xml file (but priority to the opened file if available) 2591 2572 end 2592 if Check Indexing2573 if CheckRelabel 2593 2574 i1=str2double(get(handles.FileIndex,'String')); 2594 2575 if isnan(i1) … … 2939 2920 RootFile=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 2940 2921 index_string=''; 2922 [~,RootFile]=fileparts(RootFile);%suppress the file extension 2941 2923 set(handles.RootFile,'String',RootFile) 2942 2924 else … … 3734 3716 end 3735 3717 end 3736 %% case of file relabeling (PCO, Telops ...)3718 %% case of file relabeling (PCO, TelopsIR...) 3737 3719 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries') 3738 3720 [RootName,~,Ext]=fileparts(FileName); -
trunk/src/xml2struct.m
r1191 r1192 86 86 case 'char' 87 87 out=str2double(strsplit(ss));% convert to number or vector (str2num applied to a fct name executes this fct by 'eval', thus this possibility had to be ruled out above 88 if isnan(out)88 if find(isnan(out)) 89 89 sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables 90 90 if ~isempty(sep_ind) … … 102 102 check_numeric=zeros(size(ss)); 103 103 for ilist=1:numel(ss) 104 if ~isnan(str2double(strsplit(ss{ilist}))) 105 out{ilist,1}=str2double(strsplit(ss{ilist})); 106 check_numeric(ilist)=1; 107 else 104 if find(isnan(str2double(strsplit(ss{ilist})))) 108 105 sep_ind=regexp(ss{ilist},'\s&\s');% check for separator ' & ' which indicates column separation in tables 109 106 if ~isempty(sep_ind) … … 115 112 out{ilist,1}=ss{ilist}; %reproduce the input string 116 113 end 114 else 115 out{ilist,1}=str2double(strsplit(ss{ilist})); 116 check_numeric(ilist)=1; 117 117 end 118 118 end
Note: See TracChangeset
for help on using the changeset viewer.
