dropmiss.m (366B)
1 % dropmiss.m 2 % 3 % Accepts a TxN matrix and returns a TxQ matrix where Q is the number or 4 % columns of X that have no missing observations. "kept" is a vector of 5 % zeros and ones to indicate which columns were kept. 6 7 function [z,kept]=dropmiss(x); 8 9 if (size(x,1)>1) & (size(x,2)>1); 10 kept= (~any(isnan(x)))'; 11 else; 12 kept=~isnan(x)'; 13 end; 14 z=x(:,kept);