Changeset 8744


Ignore:
Timestamp:
06/28/11 14:33:36 (14 years ago)
Author:
jschierm
Message:

expread.m: Added closed structure field, and only delete last point if closed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/m/utils/Exp/readwrite/expread.m

    r8726 r8744  
    5757        %Get number of nods and density
    5858   A=fscanf(fid,'%f %f',[1 2]);
    59    if whole==1,
    60        Struct(count).nods=A(1);
    61    else
    62        Struct(count).nods=A(1)-1;
    63    end
     59   Struct(count).nods=A(1);
    6460   Struct(count).density=A(2);
    6561
     
    7571        if(Struct(count).nods~=length(Struct(count).x))error(['Profile ' num2str(count) ' reports incorrect length']); end;
    7672
    77         %skip last coordinate if whole=0,
    78    if whole==0, fscanf(fid,'%f %f',[1 2]); end
     73        %Check if closed
     74        if (Struct(count).nods > 1) && ...
     75           (Struct(count).x(end) == Struct(count).x(1)) && ...
     76           (Struct(count).y(end) == Struct(count).y(1))
     77                Struct(count).closed=true;
     78                %skip last coordinate if whole=0,
     79                if whole==0
     80                        Struct(count).nods=Struct(count).nods-1;
     81                        Struct(count).x   =Struct(count).x(1:end-1,1);
     82                        Struct(count).y   =Struct(count).y(1:end-1,1);
     83                end
     84        else
     85                Struct(count).closed=false;
     86        end
    7987
    8088end
Note: See TracChangeset for help on using the changeset viewer.