Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fb8a92ea authored by DIB Elian's avatar DIB Elian
Browse files

Added function to compute tight grid of non missing data in matrices

parent 7834bd50
No related branches found
No related tags found
No related merge requests found
function [Value,gv] = tighten(Value,varargin)
%TIGHTEN Summary of this function goes here
% Detailed explanation goes here
if nargin>1
Mask = varargin{1};
elseif islogical(Value)
Mask = Value;
else
Mask = ~isnan(Value);
end
numdims = ndims(Mask);
gv = cell(1,numdims);
for dim = 1:numdims
M = any(Mask,setdiff(1:numdims,dim));
gv{dim} = find(M,1,'first'):find(M,1,'last');
end
Value = Value(gv{:});
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment