Revision 168
(checked in by cbc, 16 years ago)
|
Adding diwasp customizations.
|
Line | |
---|
1 |
function [SM]=readspec(filename) |
---|
2 |
|
---|
3 |
%DIWASP V1.1 function |
---|
4 |
%readspec: reads in spectrum file in DIWASP format and displays surface plot |
---|
5 |
% |
---|
6 |
%[SM]=readspec(filename) |
---|
7 |
% |
---|
8 |
%Outputs: |
---|
9 |
%SM A spectral matrix structure containing the file data |
---|
10 |
% |
---|
11 |
%Inputs: |
---|
12 |
%filename filename for the file in DIWASP format including file extension |
---|
13 |
% |
---|
14 |
%"help data_structures" for information on the DIWASP data structures |
---|
15 |
|
---|
16 |
%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth |
---|
17 |
|
---|
18 |
datain=load(filename); |
---|
19 |
|
---|
20 |
SM.xaxisdir=datain(1); |
---|
21 |
nfreq=datain(2); |
---|
22 |
ndirs=datain(3); |
---|
23 |
SM.freqs=datain(4:nfreq+3); |
---|
24 |
SM.dirs=datain(nfreq+4:nfreq+3+ndirs); |
---|
25 |
headercheck=datain(nfreq+ndirs+4); |
---|
26 |
if headercheck~=999 |
---|
27 |
error('corrupt file header'); |
---|
28 |
end |
---|
29 |
mat=datain(nfreq+ndirs+5:nfreq+ndirs+4+(nfreq*ndirs)); |
---|
30 |
|
---|
31 |
S=reshape(mat,ndirs,nfreq); |
---|
32 |
SM.S=S'; |
---|
33 |
|
---|
34 |
plotspec(SM,1); |
---|