MATLAB: Real Time workshop static variables

code generationMATLABreal timereal time workshopsimulinkvariables

Hi,
I am using real time workshop to convert two separate and independent simulink models to C files, to be used on the same piece of hardware (integrated into another C file). The problem I have is that both these models have look up tables in them and when their respective C codes are integrated into one big C code, errors are generated (due to variable names being redundant).
So currently I am having to manually change the 'extern' variables (like extern int_T rt_GetLookupIndex) into 'static' before compiling the final C code. These variables are generated during the conversion of the simulink model into C.
Is there any way of automatically setting these variables as static when you use Real Time workshop to convert them to C? As in is there any way of defining these look up tables to be used only till the end of the respective C code? The look up tables values are defined in the matlab before using real time workshop to convert them to C.
Regards, DPac

Best Answer

You need to define a Custom Storage Class and apply it to the relevant signals/parameters. Once you have defined a Custom Storage Class, simply specify static as the qualifier.