ssWriteRTWStrVectParam

Write a vector of string parameters to the model.rtw file

Syntax

int_T ssWriteRTWStrVectParam(SimStruct *S,  const char_T *name,
  const void *value, int_T size)

Arguments

S

SimStruct representing an S-Function block.

name

Parameter name.

value

Parameter values.

size

Number of elements in the vector.

Returns

An int_T (1 or 0) or boolean_T (true or false) indicating the success or failure of the function.

Description

Use this function in mdlRTW to write a vector of string parameters to this S-function's model.rtw file.

Languages

C, C++

Example

The following lines write the three strings "one", "two", and "three" to a parameter named count in the model.rtw file. To create the vector of strings to pass to the ssWriteRTWStrVectParam function, enclosed the entire string in quotation marks and square brackets. Then, enclose each individual string parameter in quotation marks preceded by a backslash, as follows:

const char *str = "[\"one\",\"two\",\"three\"]";

if (!ssWriteRTWStrVectParam(S, "count", str,3)){
    return;
}

When code is generated for a model containing this S-function, the model.rtw file contains the line:

count		      ["one","two","three"]

You can access the elements of the parameter count in the S-function's TLC file. For example, the following line in the TLC file:

/* Loop number = %<count[0]> */

appears as the following comment in the generated code:

/* Loop number = one */

See Also

mdlRTW

Was this topic helpful?