readxyzfile#
[x, y, z] = readxyzfile(xyzfilename, xyzfilelocation, zscale, domain, xmin, xmax, ymin, ymax, savedata, outfilename, outfilelocation)
Description#
Read and extract x (longitude), y (latitude) and z (elevation) data from ASCII gridded (tabular) xyz file
Use readdatafile function for more options
Inputs#
- xyzfilename
- Name of xyz file between ‘ ‘ mark, example: ‘xyzfile.xyz’xyz file should be in form of 3 coloumn format
- xyzfilelocation=pwd;
Location of xyz file between ‘ ‘ mark, example: ‘C:'
- zscale=1;
Scale z (elevation) data by factor of zscale
- domain=’all’;
- Define a domain to be extracted from data‘all’: all xyz data in input file are extracted‘domain’: only data within a defined domain are extracted
- xmin=-180;
Minimum x (longitude) of domain to be extracted
- xmax=180;
Maximum x (longitude) of domain to be extracted
- ymin=-90;
Minimum y (latitude) of domain to be extracted
- ymax=90;
Maximum y (latitude) of domain to be extracted
- savedata=’no’;
- Define if save xyz data in a file or not in outfilelocation folder‘no’: does not save‘yes’: save xyz data as csv file
- outfilename=’xyzdata.csv’;
- Name of output file between ‘ ‘ mark, example: ‘xyzdata.csv’outfilename should have ‘.csv’ extension
- outfilelocation=pwd;
Location of output file between ‘ ‘ mark, example: ‘C:'
Outputs#
- x
x (longitude) data extracted from xyz file
- y
y (latitude) data extracted from xyz file
- z
z (elevation) data extracted from xyz file
Examples#
xyzfilename='xyzfile.xyz'; %e.g. xyzfilename='PersianGulf_ETOPO1.xyz'
xyzfilelocation='C:\'; %e.g. xyzfilelocation='C:\datafolder'
[x,y,z]=readxyzfile(xyzfilename,xyzfilelocation);
xyzfilename='xyzfile.xyz'; %e.g. xyzfilename='PersianGulf_ETOPO1.xyz'
xyzfilelocation='C:\'; %e.g. xyzfilelocation='C:\datafolder'
[x,y,z]=readxyzfile(xyzfilename,xyzfilelocation,1,'all',-180,180,-90,90,'no');
References#
Geospatial data