Changeset 26631
- Timestamp:
- 11/16/21 13:28:18 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/shp/shp2exp.m
r23461 r26631 48 48 elseif strcmpi(shp(i).Geometry,'Point'), 49 49 x=shp(i).X; y=shp(i).Y; 50 expstruct(end+1).x=x; 51 expstruct(end).y=y; 52 expstruct(end).nods=length(x); 53 expstruct(end).density=1; 54 expstruct(end).closed=0; 55 %exp(end).name=num2str(shp(i).id); 50 if ~isnan(x) && ~isnan(y) 51 expstruct(end+1).x=x; 52 expstruct(end).y=y; 53 expstruct(end).nods=length(x); 54 expstruct(end).density=1; 55 expstruct(end).closed=0; 56 %exp(end).name=num2str(shp(i).id); 57 end 58 elseif strcmpi(shp(i).Geometry,'PointZ'), 59 shp(i) 56 60 elseif strcmpi(shp(i).Geometry,'Line'), 57 x=shp(i).X; y=shp(i).Y; 58 expstruct(end+1).x=x; 59 expstruct(end).y=y; 60 expstruct(end).nods=length(x); 61 expstruct(end).density=1; 62 expstruct(end).closed=0; 61 x=shp(i).X(:); y=shp(i).Y(:); 62 pos = find(~isnan(x) & ~isnan(y)); 63 idx=find(diff(pos)~=1); 64 A=[idx(1);diff(idx);numel(pos)-idx(end)]; 65 Cx=mat2cell(x(pos),A,1); 66 Cy=mat2cell(y(pos),A,1); 67 for i=1:numel(Cx) 68 expstruct(end+1).x=Cx{i}; 69 expstruct(end).y=Cy{i}; 70 expstruct(end).nods=length(Cx{i}); 71 expstruct(end).density=1; 72 expstruct(end).closed=0; 73 end 63 74 end 64 75 end
Note:
See TracChangeset
for help on using the changeset viewer.