RSKaddchannel.m
Arguments
Input
-Required-
RSK
data
: structure containing the data to be added
-Optional-
- channel : name of the added channel, default is 'unknown'
- unit : unit of the added channel, default is 'unknown'
Output
RSK
This function adds a new channel with defined channel name and units. If the new channel already exists in the RSK structure, it will overwrite the old one.
The data for the new channel must be stored in a field of newChan
called "values" (i.e., newChan.values
). If the data is arranged as profiles in the RSK structure, then newChan must be a 1xN array of structures of where N = length(RSK.data).
The code block below shows an example for using RSKaddchannel
:
% In this example we compute Absolute Salinity and add it to the RSK structure
% using the TEOS-10 GSW function "gsw_SP_from_C".
p = getchannelindex(RSK,'sea pressure');
sp = getchannelindex(RSK,'salinity');
ncast = length(RSK.data);
sa = repmat(struct('values',[]),1,ncast);
for k = 1:ncast,
sa(k).values = gsw_SA_from_SP(RSK.data(k).values(:,sp),RSK.data(k).values(:,p),-150,49);
end
RSK = RSKaddchannel(RSK,'data',sa,'channel','Absolute Salinity','unit','g/kg');