Commit 2c8ae50b authored by Pierre Cazenave's avatar Pierre Cazenave
Browse files

Removed the nested looped in place of logical indexing.

parent f2be6afa
function [array] = zero_to_nan(array)
function array = zero_to_nan(array)
% Replaces data outside error bands with an interpolated value
% Replaces values of zero with NaN.
for ii=1:cc
ix = find((array(:,ii))==0.);
if ~isempty(ix)
for i = 1:length(ix);
array(ix(i),ii) = NaN;
% Author(s)
% Pierre Cazenave (Plymouth Marine Laboratory)
% Revision history
% 2017-03-27 Removed the loops and used logical indexing instead.
array(array == 0) = nan;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment