Simulink function to Arduino

Hi all,
I am dealing with a problem about Simulink and Arduino. I have a control algorithm that I want to use for an inverted pendulum. Of course it's possible to program it in basic C, but I was wondering if it's possible to do it with Simulink, compile then this functions and use it on the main Arduino program. But I've found one problem: each time I search on the Internet about the compilation from Simulink to Arduino I have found topics related to deploy a program to it, and that's not my problem.
So, summarizing:

  • I have an Arduino program which controls motors, communications and so on.
  • I have an algorithm in Simulink which I want to compile.
  • I want to use the compiled Simulink function in my Arduino program.
    Is it possible?
    Thanks in advance!

Anyone...?