0

We have developed a set of matlab functions that have been tested (basically event detectors whose inputs are bio signals, thus time series).

We now want to do Simulink simulation using« these m files whose input will be the mentioned bio-signals time series.

What would be the simplest way to do this , having in mind that each mentioned m file has about 2000 code lines and has a certain degree of complexity (wavelets etc).

Many thanks in advance

1 Answers1

1

You've got two issues

  1. How to deal with inputting the time series

    For this you most likely want to use a From Workspace block to read the data from the MATLAB Workspace. But exactly how to do this will depend on exactly what's in your time series.

  2. How to incorporate the m-files

    This will depend a little on what the inputs and outputs from your function are. Assuming they are numeric then the easiest, and most likely the best way to do this, is to use MATLAB Function blocks and inside those blocks just make function calls to your existing functions. That is, the blocks are just wrappers into your existing code. I would recommend doing this rather than copying the code into the blocks as it means your Simulink model is using exactly the same code as you are currently using (and if you make any changes to the code you don't need to remember to do it in two places.

    If the inputs and outputs aren't numeric then you can forget about using Simulink.

Of course, doing both of the above leads to the question of why you are interested in using Simulink as it's just going to be a wrapper around your existing code.

Phil Goddard
  • 10,286
  • 1
  • 13
  • 25
  • Dear Phil, Thank you for your reply. The input is a numeric electromyographic signal and the outputs will be as well. I have tries to use one of my functions as a Simulink block, and the input would be the electromyographic signal. Basically the block would perform some wavelet operations over the signal,peak finding and thresholding . Although the algorithm is working quite well in the Matlab, I get a lot of errors in Simulink. The idea is not to use Simulink as a wraper, the idea is to make this code available to be deployed for an Android application. – Arnaldo Batista Apr 19 '18 at 09:43