Spark! Fuzzy Logic Editor Help


Variables | Sets | Rules | API | Integration | Tutorial


get_value()

Gets the value of a fuzzy variable.

float get_value(int var_idx)

Parameters

int var_idx index of the fuzzy variable to get the value for

Return Value

The value of the variable.  If an invalid variable index is passed in zero is returned and an error message is written, call get_msg_textA() to retrieve the error.

Note:  You should not all this to get the value of the output variable.  Use get_cog_output() or get_mom_output() for that.  See the explanation of those functions for more details.

Remarks

The index of the variable should be from the .h file exported from the Spark! model.  The variable's index may not coincide with the screen position of the variable.

See Export .h File for more information

Example

void get_values(SparkModel* model)
{
    cout << "Enemy Distance: ";
    cout << model->get_value(VAR_1_IDX) << endl;

} // end get_values()