Watch this Author's files
This is great! Thanks!
I made a slight modification to deal with NaN values. I changed this: x = x(:); y = y(:); z = z(:); w = w(:);
to this: x = x(~isnan(z)); y = y(~isnan(z)); z = z(~isnan(z)); w = w(~isnan(z));
Contact us at files@mathworks.com