MATLAB Answers

Why do I see an "Inferred type does not match specified type" error when running my test harness?

10 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Apr 2020
Edited: MathWorks Support Team on 7 Apr 2020
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;


Sign in to comment.

More Answers (0)

Sign in to answer this question.




Translated by