Section: Functions and Scripts
functionname('arg1','arg2',...,'argn')
or the parenthesis and commas can be removed
functionname 'arg1' 'arg2' ... 'argn'
The quotes are also optional (providing, of course, that the argument strings have no spaces in them)
functionname arg1 arg2 ... argn
This special syntax enables you to type hold on
instead of
the more cumbersome hold('on')
. The caveat is that FreeMat
currently only recognizes the special calling syntax as the
first statement on a line of input. Thus, the following construction
for i=1:10; plot(vec(i)); hold on; end
would not work. This limitation may be removed in a future version.
strcattest.m function strcattest(str1,str2) str3 = [str1,str2]; printf('str1 = %s, str2 = %s, str3 = %s\n',str1,str2,str3);
We call strcattest
using all three syntaxes.
--> strcattest('hi','ho') str1 = hi, str2 = ho, str3 = hiho --> strcattest 'hi' 'ho' str1 = hi, str2 = ho, str3 = hiho --> strcattest hi ho str1 = hi, str2 = ho, str3 = hiho