function [line, name] = lineno(asString) % lineno -- Line-number of the calling function. % [line, name] = lineno(asString) returns the line-number % and function-name that called this function, or 0 and '' % if called from the Matlab command-line prompt. If the % asString flag is non-zero, the line-number is returned % as a string; default flag = 0. % Copyright (C) 2000 Dr. Charles R. Denham, ZYDECO. % All Rights Reserved. % Disclosure without explicit written consent from the % copyright owner does not constitute publication. % Version of 29-Nov-2000 15:20:37. % Updated 04-Dec-2000 07:54:44. [stack, index] = dbstack; if length(stack) > 1 stack = stack(2); else stack = []; stack.line = 0; stack.name = ''; end if nargout < 1 disp(stack) else line = stack.line; name = stack.name; if nargin > 0 & any(asString(:)), line = int2str(line); end end