Main Content

ssWriteRTWStrVectParam

Write a vector of character vector 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 that represents 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 character vector parameters to this S-function's model.rtw file.

Languages

C, C++

Examples

The following lines write the three character vectors "one", "two", and "three" to a parameter named count in the model.rtw file. To create the vector of character vector to pass to the ssWriteRTWStrVectParam function, enclosed the entire character vector in quotation marks and square brackets. Then, enclose each individual character vector 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

Version History

Introduced before R2006a