From: Laub Frosch on
How can I start a .m-file / a function per java or c++ ? E.g. function addition( A, B )

Can I start it per matlab file.m 1 2 ??

Thank you!
From: Walter Roberson on
Laub Frosch wrote:
> How can I start a .m-file / a function per java or c++ ? E.g.
> function addition( A, B )
>
> Can I start it per matlab file.m 1 2 ??

There are multiple ways.

- You can call the engine (eng*() series of calls)

- you can use system('matlab addition 1 2')

- you can use popen()

- you can fork() and exec*()

and probably other ways.

The mechanism you will wish to use will depend upon how extensive your
interaction with Matlab is, and how you wish to receive output. system()
would only be suitable if you were content with an exit status: exit
statuses would be 0 if the matlab terminated normally, and would be some
non-zero value if matlab terminated because of an error, including
because of an uncaught error() statement.