Anybody - MATLAB

Hi all,
I’m trying to to execute Anybody as a Batch in Matlab. Starting the Batch works fine with DOS_command but MATLAB gets no information back as soon as Anybody is finished. Therefor it does not execute the next step in calculations.

I found out that 2 different informations would help me:

  1. Anybody sending a message to MATLAB that it is finished or

  2. Shutting down Anybody (automatically) after the calculations are finished. For some reason MATLAB than gets the information that Anybody is shut down and executes next steps in the code. Is there a command which shuts down anybody after being finished?

Thanks for your help!

Hi Jo

I you are using a macro file with the console application then you may need to also specify ‘-ni’ keyword:

anybodycon.exe -m “macorfile.anymcr” -ni

I think this is the best option. I will ensure that anybodycon does not enter the interactive mode after it has run the macro commands. Thus it will always exit when the calculations are done.

Another way is to to add the ‘exit’ macro command after your other macros commands. However, if there is any error in the script it may still go to the interactive mode.

Btw. If you are interesting in batch processing anybody models there there is a tutorial here: Batch processing
It shows some cool features and it doesn’t rely on matlab.

Hope it helps you.

Hi Morten,
thanks alot for your very quick reply.
I already tried the exit macro, but always got the following message:

Macro command > exit

Warning : exit : has no effect for macro running from GUI.

But Anybody is not been closed.Therefore Matlab gets no signal back.

In MatLab I’m using the “system” function to start the anybodycon.exe file to start the marcro.

What do you mean with:

"you may need to also specify ‘-ni’ keyword:

anybodycon.exe -m “macorfile.anymcr” -ni"

Could you give an example?

Thanks alot and have a great day,

Hi Jo

I may have misunderstood what you are doing. Now, I suspect you are actually calling the GUI application (anybody.exe) from matlab. Am I right?

What you should do is call the anybody console application “anybodycon.exe”.

You should put your macro commands in a file (e.g. “macro.txt”)

load “MyModel.main.any”
operation Main.Study.Kinematics

Then you can call the “anybodycon.exe” with the following DOS command.

anybodycon.exe -m “macro.txt” -ni

The “-m” command specifies the path the file with the macro commands. The “-ni” command indicates that the console application should be started in non-interactive mode. Thus, the program will automatically quit after executing the commands.

In Matlab you can capture the console output to inspect for any errors etc.

/Hope this helps you.

I solved the problems above. Thanks for your help.
Now I got the problem that after saving data in the inverse dynamics matlab stays “busy” and says closing last loaded model…

and after a while a window pops up which says that anybodycon.exe is not replying anymore. Data are saved though. When I close the window Matlab is not “busy” anymore. But obviously I don’t want to close this window every time i run invers dynamics…

Do you have any suggestions on that?


Hi Johannes

I may have a similar problem with some of my batch processing scripts. Some crash when the model exits. When I click OK in the crash dialog box that appears I still get all the output from the console.

I run my batch processing scripts from python. I think it must be a bug in the anybody modelling system, and I am talking to one the developers about a fix.

I will keep you update when I figure something out.


Hi Morton,
thanks for your quick response.
First I thought it is a problem with saving big data but I commented the “saving” out but the problem still appears.

I also get all data when I close the information box.
I don’t have the problem with kinematics or foot position, only when I run inverse dynamics model . In AnyBody 6.0

Matlab usually say ans=0 after closing a model, but after the inverse dynamics and closing the infomation box matlab writes something like ans=-1*10^9.

I assume that’s not the right information for closing down.

I would be very happy if you could ask someone and keep me up to data.



I’m not sure if this (still) helps you, but in my case re-loading the model by inserting the lines:

operation Main.Study.InitialConditions

in front of the exit-command in the “macro.txt”, solved the problem.

Best regards,

Hi guys!
Sorry for the delay… and I hope it could help you if you’re still blocked with that specific problem: I wrote functions to launch lots of studies in batch. Please, contact me on my e-mail if you’re interested, I’ll share it with pleasure !!