Changeset 884 for trunk


Ignore:
Timestamp:
Mar 23, 2015, 11:19:28 PM (10 years ago)
Author:
sommeria
Message:

bugs corrected

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_lvm.m

    r809 r884  
    5353%% get the list of channel names
    5454Break_pos=regexp(txt,'\n','once');%find the line break
    55 VarNameCell=textscan(txt(1:Break_pos-1),'%s');% read list of variable names (until next line break)
     55VarNameCell=textscan(txt(1:Break_pos-2),'%s');% read list of variable names (until next line break)
    5656Data.ListVarName=VarNameCell{1};
    5757Data.ListVarName(end)=[]; %remove last name (Comment)
  • trunk/src/series/aver_stat.m

    r883 r884  
    239239end
    240240nbfiles=0;%counter of the successfully read files (bad files are skipped)
    241 VarMesh=NaN;
    242 if isfield(Param,'ProjObject') && ismember(Param.ProjObject.ProjMode,{'inside','outside'})&& isfield(Param.ActionInput,'VarMesh')%case of histograms
     241VarMesh=[];
     242if isfield(Param,'ProjObject') && ismember(Param.ProjObject.ProjMode,{'inside','outside'})
     243    if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'VarMesh')%case of histograms
    243244     VarMesh=Param.ActionInput.VarMesh;
     245    else
     246       VarMesh=[];
     247       disp_uvmat('WARNING','automatic bin size for histograms, select aver_stat again to set the value',checkrun)
     248    end
    244249end
    245250%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
     
    312317            DataOut=Field;%outcome reproduces the first (projected) field by default
    313318            DataOut.Conventions='uvmat'; %suppress Conventions='uvmat/civdata' for civ input files         
    314             if ismember(Param.ProjObject.ProjMode,{'inside','outside'})%case of histograms
     319            if isfield(Param,'ProjObject')&& ismember(Param.ProjObject.ProjMode,{'inside','outside'})%case of histograms
    315320                for ivar=1:numel(Field.ListVarName)% list of variable names before projection (histogram)
    316321                    VarName=Field.ListVarName{ivar};
     
    324329            else
    325330                errorvar=zeros(numel(Field.ListVarName));%index of errorflag associated to each variable
    326                 for ivar=1:numel(Field.ListVarName)
    327                     VarName=Field.ListVarName{ivar};
    328                     DataOut.(VarName)=zeros(size(DataOut.(VarName)));% initiate each field to zero
    329                     NbData.(VarName)=zeros(size(DataOut.(VarName)));% initiate the nbre of good data to zero
    330                     for iivar=1:length(Field.VarAttribute)
    331                         if isequal(Field.VarDimName{iivar},Field.VarDimName{ivar})&& isfield(Field.VarAttribute{iivar},'Role')...
    332                                 && strcmp(Field.VarAttribute{iivar}.Role,'errorflag')
    333                             errorvar(ivar)=iivar; % index of the errorflag variable corresponding to ivar
     331                if isfield(Field,'VarAttribute')
     332                    for ivar=1:numel(Field.ListVarName)
     333                        VarName=Field.ListVarName{ivar};
     334                        DataOut.(VarName)=zeros(size(DataOut.(VarName)));% initiate each field to zero
     335                        NbData.(VarName)=zeros(size(DataOut.(VarName)));% initiate the nbre of good data to zero
     336                       
     337                        for iivar=1:length(Field.VarAttribute)
     338                            if isequal(Field.VarDimName{iivar},Field.VarDimName{ivar})&& isfield(Field.VarAttribute{iivar},'Role')...
     339                                    && strcmp(Field.VarAttribute{iivar}.Role,'errorflag')
     340                                errorvar(ivar)=iivar; % index of the errorflag variable corresponding to ivar
     341                            end
    334342                        end
    335343                    end
     344                    DataOut.ListVarName(errorvar(errorvar~=0))=[]; %remove errorflag from result
     345                    DataOut.VarDimName(errorvar(errorvar~=0))=[]; %remove errorflag from result
     346                    DataOut.VarAttribute(errorvar(errorvar~=0))=[]; %remove errorflag from result
     347                else
     348                                   for ivar=1:numel(Field.ListVarName)
     349                                       VarName=Field.ListVarName{ivar};
     350                        DataOut.(VarName)=zeros(size(DataOut.(VarName)));% initiate each field to zero
     351                        NbData.(VarName)=zeros(size(DataOut.(VarName)));% initiate the nbre of good data to zero
     352                                   end
    336353                end
    337                 DataOut.ListVarName(errorvar(errorvar~=0))=[]; %remove errorflag from result
    338                 DataOut.VarDimName(errorvar(errorvar~=0))=[]; %remove errorflag from result
    339                 DataOut.VarAttribute(errorvar(errorvar~=0))=[]; %remove errorflag from result
     354               
    340355            end
    341356        end   %current field
     
    344359            sizmean=size(DataOut.(VarName));
    345360            siz=size(Field.(VarName));
    346             if ismember(Param.ProjObject.ProjMode,{'inside','outside'})
     361            if isfield(Param,'ProjObject') && ismember(Param.ProjObject.ProjMode,{'inside','outside'})
    347362                if isfield(Data{1},VarName)
    348363                    MaxValue=max(DataOut.(VarName));% current max of histogram absissa
     
    387402end
    388403%%%%%%%%%%%%%%%% end loop on field indices %%%%%%%%%%%%%%%%
    389 if ~ismember(Param.ProjObject.ProjMode,{'inside','outside'})
     404if ~(isfield(Param,'ProjObject') && ismember(Param.ProjObject.ProjMode,{'inside','outside'}))
    390405    for ivar=1:length(Field.ListVarName)
    391406        VarName=Field.ListVarName{ivar};
  • trunk/src/series/civ_input.m

    r883 r884  
    960960                index_pair=index_pair+1;
    961961                displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)];
    962                 displ_pair_dt{ipair}=displ_pair{ipair};
     962                displ_pair_dt{index_pair}=displ_pair{index_pair};
    963963                dt(index_pair)=numod_b-numod_a;%default dt
    964964                if size(Time,1)>ref_i && size(Time,2)>numod_b  % && ~checkframe
  • trunk/src/series/time_series.m

    r883 r884  
    304304    if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'VarMesh')%case of histograms
    305305        VarMesh=Param.ActionInput.VarMesh;
     306    else
     307        VarMesh=[];
     308        disp_uvmat('WARNING','automatic bin size for histograms, select time_series again to set the value',checkrun)
    306309    end
    307310end
Note: See TracChangeset for help on using the changeset viewer.