Compatibility: Difference between revisions
Jump to navigation
Jump to search
add description to call internal functions
(→Are we running octave?: remove extraneous 'end') |
(add description to call internal functions) |
||
Line 26: | Line 26: | ||
r = x; | r = x; | ||
end</syntaxhighlight>}} | end</syntaxhighlight>}} | ||
== Calling an internal octave function (even though you shouldn't) == | |||
Octave internal functions start with underscores (ie __delaunayn__ ). Normally, user programs | |||
shouldn't call these, but sometimes, for testing, you may want to do that. The problem is | |||
that matlab can't accept function names with underscores. The trick is to use feval | |||
{{Code|code with underscores|<syntaxhighlight lang="matlab"> | |||
if isoctave () | |||
T = feval('__delaunayn__', opts) | |||
else | |||
% matlab code here | |||
end | |||
% Code to check the results are compatible</syntaxhighlight>}} |