Simulink Real-Time Block. If you have a 64-bit machine, make sure you have the current version (V4) since it includes a 64-bit executeable file (mexw64).
To install this feature into your Simulink library, copy the files in the zip file into a directory somewhere on your computer. When you installed Matlab, a "MATLAB" directory was created in your "Documents" folder. If you put them here then you are done because this directory is already in your Matlab searchpath.
If you put them somewhere else you need to add that directory to your Matlab searchpath. To to this, create the following file (or edit it if it already exists):
C:\Documents and Settings\MATLAB\startup.m (old Windows)
C:/Users/username/Documents/MATLAB/startup.m (Windows 7+)
Add the following line where ??? is the directory name where you stored the Real-Time Block files:
addpath 'C:/Users/myusername/Documents/MATLAB/rtblock''
Note that in earlier versions of Matlab (2007 and prior), the "startup.m" file is in the "work" directory in the folder where you installed the software.
Start up MATLAB and open your SIMULINK browser. A 'Simulink Execution Control' page should exist with the SEC block in it (looks like a stopwatch). Drag this block onto your model to have it run in real time. You do not need to connect the block to anything but connecting it to a 'Terminator' sink block will get rid of a warning message. |