MATLAB: Do I see an “Inferred type does not match specified type” error when running the test harness

harnessinferredsequencesimulink testtesttype

I have a boolean local variable in my Test Sequence block. When I try to assign the value to 1 (true), I get this error:
Inferred type ('double') for data 'Local1' does not match specified type ('boolean').
Error while generating code for chart Test Sequence.
Here is a screenshot of my setup:
What could cause this?

Best Answer

This happens because in the following code:
Local1 = 1;
Local1 is declared to be a boolean variable, but the value "1" is of type double. To prevent this error, you can use the "true" keyword to initialize Local1:
Local1 = true;