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

92 vues (au cours des 30 derniers jours)
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?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 7 Avr 2020
Modifié(e) : MathWorks Support Team le 7 Avr 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;

Plus de réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by