\cat programming
repmat(X, m, n);
http://www.mathworks.com/access/helpdesk_r13/help/techdoc/math_anal/datafun7.html
Find indices of elements in vector that are not NaNs, then keep only the non-NaN elements.
i = find(~isnan(x)); x = x(i);
Remove NaNs from vector.
x = x(find(~isnan(x)))
Remove NaNs from vector (faster).
x = x(~isnan(x));
Remove NaNs from vector.
x(isnan(x)) = [];
Remove any rows of matrix X containing NaNs.
X(any(isnan(X)'),:) = [];
X(:);
reshape(x, m, n);