IntEnumType

조회 수: 4 (최근 30일)
Daniel
Daniel 2011년 1월 31일
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
Daniel
Daniel 2011년 2월 1일
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 2011년 2월 1일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Daniel
Daniel 2011년 2월 1일
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.

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by