I'm building a simulink model with multiple matlab function blocks( http://in.mathworks.com/help/simulink/slref/matlabfunction.html ). Each of these function blocks have a lot of constants, for example (g=9.8), common between them. I want to initialize all of these constants in one go so that I don't have to do so in each function block.
I tried initialising all the variables in matlab workspace, but they don't seem to be working.
What is the best and easiest way to go forward with this?
You need to either define your global variables as Simulink.Signal
object or a Data Store Memory block and then define them as global in your MATLAB function. You cannot access the regular MATLAB variables from MATLAB workspace.
There is a detailed page about this on MAthworks website with a good example.