Index: ../trunk-jpl/src/m/exp/exp2shp.m =================================================================== --- ../trunk-jpl/src/m/exp/exp2shp.m (revision 21651) +++ ../trunk-jpl/src/m/exp/exp2shp.m (revision 21652) @@ -1,16 +1,27 @@ -function exp2shp(shapefilename,expfilename,geometry) +function exp2shp(expfilename,shpfilename,geometry) %SHPWRITE - write a shape file from a contour structure % % Usage: -% exp2shp(shapefilename,expfilename,geometry) +% exp2shp(expfilename,shpfilename,geometry) % % Example: -% exp2shp('domainoutline.shp','domainoutline.exp') -% exp2shp('domainoutline.shp','domainoutline.exp','Polygon') -% exp2shp('massfluxgate.shp','massfluxgate.exp','Line') +% exp2shp('domainoutline.exp','domainoutline.shp') +% exp2shp('domainoutline.exp','domainoutline.shp','Polygon') +% exp2shp('massfluxgate.exp','massfluxgate.shp','Line') % % See also SHPREAD, SHPWRITE, SHP2EXP +%check file extensions +[pathstr,name,ext] = fileparts(shpfilename); +if ~strcmp(ext,'.shp'), + error(['Shapefile ' shpfilename ' does not have an extension .shp']); +end + +[pathstr,name,ext] = fileparts(expfilename); +if ~strcmp(ext,'.exp'), + error(['Exp file ' expfilename ' does not have an extension .exp']); +end + shp=expread(expfilename); %initialize number of profile @@ -33,5 +44,4 @@ contours(i).Y=shp(i).y; end -shapewrite(contours,shapefilename); -end +shapewrite(contours,shpfilename);