Code covered by the BSD License  

Highlights from
mydate

mydate

by

 

16 Apr 2011 (Updated )

Augments MATLAB's date/time library for improved handling of epochs and formats commonly used in GPS

is_function_called (line, func)
function answer = is_function_called (line, func)
    % number of occurrences of each pattern:
    n1 = length( regexp(line, ['\<' func '\>']) );
    n2 = length( regexp(line, ['''.*\<' func '\>.*''']) );

    answer = n1 > n2;
end

%!test
%! myassert(is_function_called ('test', 'test'));
%! myassert(is_function_called ('abc test', 'test'));
%! myassert(is_function_called ('test abc', 'test'));
%! myassert(is_function_called ('abc test abc', 'test'));
%! myassert(~is_function_called ('abctest', 'test'));
%! myassert(~is_function_called ('testabc', 'test'));
%! myassert(~is_function_called ('abc ''test'' abc', 'test'));
%! myassert(~is_function_called ('''abc test abc''', 'test'));
%! myassert(is_function_called ('''abc'' test abc', 'test'));
%! myassert(is_function_called ('abc test ''abc''', 'test'));

%!test
%! myassert(is_function_called(...
%!     'myassert (s.identifier, ''myassert:error'');', 'myassert'));

Contact us