IntEnumType

4 visualizzazioni (ultimi 30 giorni)
Daniel
Daniel il 31 Gen 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 Commenti
Daniel
Daniel il 1 Feb 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 il 1 Feb 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.

Accedi per commentare.

Risposte (1)

Daniel
Daniel il 1 Feb 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.

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by