필터 지우기
필터 지우기

assign summary of a category to new variables

조회 수: 1 (최근 30일)
Peng
Peng 2015년 4월 6일
편집: Sean de Wolski 2015년 4월 6일
Hi everyone,
I have the following code:
A = categorical({'plane'; 'car'; 'train'; 'car'; 'plane'});
summary(A)
here is the output:
>> Untitled
car 2
plane 2
train 1
I want to assign the summary to a new variable. So I tried using b=summary(A), and got:
>> Untitled
Error using categorical/summary (line 98)
Too many output arguments.
Error in Untitled (line 2)
b=summary(A)
please help me fix this problem
Thanks
Peng

채택된 답변

Matt J
Matt J 2015년 4월 6일
편집: Matt J 2015년 4월 6일
You can do this,
>> b=evalc('summary(A)')
b =
car 2
plane 2
train 1

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 4월 6일
편집: Sean de Wolski 2015년 4월 6일
Or
c = categorical({'plane'; 'car'; 'train'; 'car'; 'plane'})
b = table(categories(c),countcats(c))

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by