MATLAB: How to specify the Compu Method data format for ASAP2 objects in the code generated using Real-Time Workshop 7.3 (R2009a)

changecompurtwsimulink coder

I am using Real-Time Workshop to generate an ASAP2 database. By default, all of the ASAP2 objects have a Compu Method format of "%0.6f".
I would like to specify an integer format instead.

Best Answer

The COMPU_METHOD format is specified in the 'asap2setup.tlc' file. You can modify the format to an integer format by following the steps below:
1. Make a copy of the '$matlabroot/toolbox/rtw/targets/asap2/asap2/user' directory before making any modifications.
$matlabroot directory is the directory where MATLAB is installed and this can be obtained by executing the following command at the MATLAB Command prompt.
matlabroot
2. Remove the old 'asap2/user' directory from the MATLAB path, or add the new 'asap2/user' directory to the MATLAB path above the old directory.
3. Open the 'asap2setup.tlc' file in the 'asap2/user' directory.
4. Change 'ASAP2NumberFormat' line from '%assign ASAP2NumberFormat = "%0.6f"' to '%assign ASAP2NumberFormat = "%d"' on line 21.
5. Save the 'asap2setup.tlc' file.