Tips and tricks: Difference between revisions

Jump to navigation Jump to search
511 bytes removed ,  29 November 2011
m (formatting)
Line 64: Line 64:


=General=
=General=
==How to declare functions inside a test block==
function experience
%!test
%! experience_design_mat
%! experience_obs_eqs
%! assert (experience_design_mat == pi);
%! assert (experience_obs_eqs == exp(1));
%!
%! endfunction  % this is a trick.
%! % now we can declare functions to be used by the test above.
%!
%! function a = experience_design_mat
%!    a = pi;
%! endfunction
%!
%! function b = experience_obs_eqs
%!    b = exp(1);
%! % endfunction: don't add it here. Let test() do it.
==A funny formatting trick with fprintf found by chance==
==A funny formatting trick with fprintf found by chance==


Navigation menu