Hello friends hope you all are healthy and enjoying good health. In today's tutorial, I am going to share How to Protect Simulink Design in MATLAB and in order to do so I have used S Function method. In my previous post I have explained How to Protect your m-file Codes in MATLAB by converting it to p-file so that no one can reach to your code and now I am gonna explain how to protect your simulations in MATLAB which you create in Simulink so that your intellectual work wont go waste.There are many methods to protect the Simulink simulations and the easiest of them is using S-function. Now follow these simple steps and it won't be much difficult.

Protect Simulink Design in MATLAB

  • Open the simulation which you want to protect. Make sure you are done with the simulation and don't need any more editing. As after conversion you wont be able to edit it.
  • Now select whole of your simulation and right click on it.
  • Click on the Create Subsystem in right click listing.This will create a single block for your whole system.If you double click click this block a new window will pop up and you can see your whole model again.
  • Now right click on this newly created subsystem block and then in the listing click on Real Time Workshop and the Generate S-Function.
  • On clicking a new window will pop-up add variables if you want to control any otherwise just tick the corner which says Use Embedded Coder and hit Build.
  • It will take few seconds to build the S-function for your simulation and when its done Hurrah your simulation is now protected.
  • Now double click on your subsytem and you won't be able to open your design, instead a window pops up which will give some description.
  • You can add the complete description while generating your simulation.
  • Now start your simulation , it will work fine but no one could find your design.
Note :
  • This method is mostly used by the developers to protect their simulations.
  • Users can use their simulation but couldn't get the design of it, the design got fully protected.