Title: Import: MATLAB
1Import MATLAB
MATLAB is a high-level technical computing
language and interactive environment for
algorithm development, data visualization, data
analysis, and numeric computation.
- High-level language for technical computing
- Development environment for managing code, files,
and data - Interactive tools for iterative exploration,
design, and problem solving - Mathematical functions for linear algebra,
statistics, Fourier analysis, filtering,
optimization, and numerical integration - 2-D and 3-D graphics functions for visualizing
data - Tools for building custom graphical user
interfaces
- Requires an additional module to enable access to
OPeNDAP datasets the MATLAB Command Line Tool
2Import MATLAB OPeNDAP
The MATLAB command line tool provides a way to
read OPeNDAP datasets from within MATLAB.
loaddap (older version is loaddods)
Note the newer version adds the ability to
preserve structures in data sources
The function accepts an OPeNDAP URL from the
user, sends it out over the internet, and creates
MATLAB scalars, vectors, and matrices to hold the
data that is returned from that request.
3Import MATLAB Example Data
/snapshots.eta.1995.09.15.nc.info
xt_i longitude data
yt_j latitude data
eta surface height data
4Import MATLAB Example
url 'http//store.apac.edu.au//variable_forcing
/snapshots/snapshot.eta.1995.09.15.nc' url2
'http//store.apac.edu.au//variable_forcing/snaps
hots/snapshot.temp.1995.09.15.nc'
lat loaddap(url,'?yt_j') lon loaddap(url,
'?xt_i')
- Now have latitude and longitude vectors
defining a region near Tasmania - Use the subsampling of OpenDAP to reduce the
total amount of data transferred to matlab - lat_range -80 -20
- lon_range 110 180
lat_index find(lat.yt_j gt lat_range(1)
lat.yt_j lt lat_range(2)) lon_index
find(lon.xt_i gt lon_range(1) lon.xt_i lt
long_range(2))
- Now get the sea-surface height and temperature
fields by constructing strings of the form - ?etaxxxyyyaaabbb ?temp1xxxyyyaaa
bbb - string '?eta',num2str(lat_index(1)),'',num2st
r(lat_index(end)), - '',num2str(lon_index(1)),'',num2s
tr(lon_index(end)),'' - string2 '?temp1',num2str(lat_index(1)),'',n
um2str(lat_index(end)), - '',num2str(lon_index(1)),'',num
2str(lon_index(end)),''
5Import MATLAB Example
loaddap(url,string) loaddap(url2,string2)
figure(1) set(1,'papertype','a4letter') orient
landscape h1subplot(1,1,1) set(h1,'fontsize',16,'
fontname','helvetica','linewidth',2,'YDir','revers
e') pcolor(temp.xt_i, temp.yt_j, temp.temp)
caxis(-20 50) hold on contour(eta.xt_i,
eta.yt_j, eta.eta, -505150) shading
flat hold off xlabel('Longitude
(E)','fontsize',20,'fontname','helvetica') ylabel(
'Latitude (N)','fontsize',20,'fontname','helvetica
') title('TPAC 1/8 model output for SST(C) and
SSH(cm) (15/09/1995)','fontsize',20,'fontname','he
lvetica') axis(lon_range, lat_range)
6Import MATLAB Output