function checkreal(a,errormessage)
% checkreal(a,errormessage)
% checks if the input is real; no output, error stop if it is not.

if ~isreal(a)
   error(errormessage)
elseif ischar(a)
   error(errormessage)
end
