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)
Afficher commentaires plus anciens
MathWorks Support Team
le 19 Mar 2020
Modifié(e) : MathWorks Support Team
le 7 Avr 2020
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
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;
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Inputs dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!