How to create categorical array from integer array?

조회 수: 1 (최근 30일)
PIT
PIT 2014년 7월 23일
댓글: PIT 2014년 7월 23일
I would appreciate some help on the following:
I would like to create a categorical array from an integer array. When I use the sample code from the documentation center:
A = gallery('integerdata',3,[2,3],3);
valueset = 1:3;
catnames = {'car' 'bus' 'bike'};
B = categorical(A,valueset,catnames);
I get the following error message: Error using categorical Abstract classes cannot be instantiated. Class 'categorical' defines abstract methods and/or properties.
What does this error message mean? and how can it be resolved? Thanks!

채택된 답변

Wayne King
Wayne King 2014년 7월 23일
Which version of MATLAB are you running? I do not have any problem executing that code on R2014a or R2013b.
If you enter
which -all categorical
what is returned? The only entry should end in:
toolbox\matlab\datatypes\@categorical\categorical.m
  댓글 수: 1
PIT
PIT 2014년 7월 23일
Dear Wayne, Thanks for your quick response.
The version i'm running is: 8.1.0.604 (R2013a)
>> which -all categorical /Applications/MATLAB_R2013a.app/toolbox/shared/statslib/@categorical/categorical.m % categorical constructor

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Categorical Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by