Changeset 139 for aedes_readprocpar.m


Ignore:
Timestamp:
Aug 23, 2010, 12:56:30 PM (9 years ago)
Author:
tjniskan
Message:
  • Fixed: reading procpar files failed if any VNMR parameters contained

something else than numbers alphabets or underscores. Now all
incompatible characters are replaced with underscores (e.g. com$string
-> com_string).

  • Some further iterations to the new VNMR read function aedes_readvnmr

M aedes_readprocpar.m
M aedes_readvnmr.m
M aedes_revision.m

File:
1 edited

Legend:

Unmodified
Added
Removed
  • aedes_readprocpar.m

    r80 r139  
    104104
    105105%% Parse procpar file lines
    106 try
     106%try
    107107  nonlabelchars='123456789';
     108  field_chars = '_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
     109  nonfield_chars = char(setdiff(0:256,double(field_chars)));
    108110  for ii=1:length(procpar_str)
    109111    if any(procpar_str{ii}(1)==nonlabelchars)
     
    128130      procpar.(label){end+1} = strrep(str,'"','');
    129131    elseif procpar_str{ii}(1)=='0' % Empty line, end of block
    130     continue
     132      continue
    131133    else
    132134      %% Read label
    133135      ind=find(procpar_str{ii}==' ');
    134136      label=procpar_str{ii}(1:ind-1);
     137     
     138      %% Make sure that the characters in the label are compatible with
     139      %% Matlab structure fields. If not, replace them with underscore...
     140      ind2=ismember(label,nonfield_chars);
     141      if any(ind2)
     142        label(ind2)='_';
     143      end
    135144      procpar.(label)={};
    136145    end
     
    154163       
    155164  end
    156 catch
    157   msg=['Error while parsing procpar lines'];
    158   procpar=[];
    159   return
    160 end
     165%catch
     166%  msg=['Error while parsing procpar lines'];
     167%  procpar=[];
     168%  return
     169%end
    161170
    162171
Note: See TracChangeset for help on using the changeset viewer.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008