In MATLAB and Simulink there is not a means to have the time-step by time-step results available in the MATLAB workspace in a manner where it interacts with the Simulink simulation model in a closed-loop fashion.
I recommend reading about S-Functions in MATLAB if you would like to integrate an algorithm written in MATLAB into a Simulink model.
Then one could have the relevant signals from the PLECS portion of the model made available via Inports and Outports and fed to the S-Function block.
Depending on the nature of the function, one could also implement it in PLECS or Simulink blocks as well.