IntEnumType

3 vues (au cours des 30 derniers jours)
Daniel
Daniel le 31 Jan 2011
I see this error when trying to create an enumerated data type.
??? Error using ==> IntEnumType>IntEnumType.IntEnumType at 61 Not enough input arguments.
My script is called Color.m which is in a properly configured directory:
classdef(Enumeration) Color < Simulink.IntEnumType enumeration RED(1), GREEN(2), end end
I'm running MATLAB with Simulink ver R2010a.
I made sure to add the working directory to my matlab environment via addpath and save functions which executed fine. I'm starting to think that this is a bug.
  3 commentaires
Daniel
Daniel le 1 Fév 2011
1. What did you enter at the MATLAB command prompt to see this error?
I created a matlab script. In this case it was called Color.m and ran it.
2. What is the output of which -all Simulink.IntEnumType:
>> which -all Simulink.IntEnumType
C:\Program Files\MATLAB\R2010a\toolbox\simulink\simulink\+Simulink\IntEnumType.m % Simulink.IntEnumType constructor
Daniel
Daniel le 1 Fév 2011
I have even tried copying examples straight from Simulink's help documents and i still see this error. In this case i created a script called BasicColors.m which contains the following:
classdef(Enumeration) BasicColors < Simulink.IntEnumType
enumeration
Red(0)
Yellow(1)
Blue(2)
end
methods (Static = true)
function retVal = getDefaultValue()
retVal = BasicColors.Blue;
end
end
end
I run this and still get the same error which is:
??? Error using ==> IntEnumType>IntEnumType.IntEnumType
at 61
Not enough input arguments.
Other people on my team see the same thing. I almost think it is an issue with MATLAB R2010a.

Connectez-vous pour commenter.

Réponses (1)

Daniel
Daniel le 1 Fév 2011
Ok i figured out my problem. I did not need to run the MATLAB script. I can just drop a enumerated constant block in simulink and type in the enumerated name in the Output data type field in the Source Block Parameters. You also need to fill out the Value: field with classname.enum and it works!
I hope this helps out some newbs out there.

Catégories

En savoir plus sur Simulink Functions 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!

Translated by