MATLAB: How to run a M-file with Simulink model in the same time and this M-file takes Simulink model data from workspace per each time step

matlab/simulink jade

Dear All,
I need an urgent help from you.
I am working in PhD research to interface between MATLAB/Simulink and JADE (Java agent Environment Development) software. To link between them must be there a M-file (interface) transfers data between them for each time step from MATLAB workspace to JADE.
My question, How can I run a M-file with Simulink model in the same time and this M-file takes Simulink model data from workspace per each time step ?
Thank you so much and I am waiting your response.
Best Regards, Mohammed