The best way would be to generate code for Foo directly, skipping FooCaller. That is, in the MATLAB Coder App, pick Foo.m as the entry point. If you are using command line tool (codegen) then do "codegen Foo ....args..." instead of "codegen FooCaller ...args ...". This way, you have complete control over the prototype of Foo, you can specify exactly what input types should it have in the C code and you can observe the output types.
If for some reason you do want to use FooCaller as an entry point, you can tell MATLAB Coder that Foo should remain separate and not be inlined into FooCaller. You can do that by adding
coder.inline('never');
in the body of Foo.
This will keep Foo and FooCaller as separate functions and will generate Foo.c and FooCaller.c (unless you configured MATLAB Coder to bundle all functions into one .c file). However, this way you don't have complete control over the prototype of Foo -- coder may decide to optimize it by hard-coding certain inputs, or removing outputs that are not used inside FooCaller etc.
Does this make sense?
Best Answer