Remove variables

RemoveVariable removes a variable that has been added to KINGSTAR shared memory. After the variable is removed, you can still get its value before the variable is overwritten by a new variable, but you cannot use GetVariable or GetVariables to get the removed variable anymore. When you remove a variable, you need to give the variable's ID, which is assigned by KINGSTAR.

The following code is written in the function CreateUserVariables.

Copy
/*------Remove variables------*/

RtPrintf("Remove user variables.\n\n");

//Remove the added user variables.
RemoveVariable(uTemperature.Id);
RemoveVariable(uVoltage.Id);
RemoveVariable(uWarning.Id);