if norm([x y z])<1000 error('error: for near surface coordinates only'); end in matlab

You can use the norm function to calculate the Euclidean magnitude of the 3D vector [x, y, z]. In this case, you want to throw an error if the magnitude is less than 1000. Here's how you can do it using a simple if statement:

main.m
xyz = [x, y, z]; % create [x, y, z] vector
if norm(xyz) < 1000 
    error('error:  for near surface coordinates only'); 
end
125 chars
5 lines

This code snippet checks if the magnitude of the xyz vector is less than 1000. If it is, it will throw an error with the message, error: for near surface coordinates only.

gistlibby LogSnag