필터 지우기
필터 지우기

alternative to groupcounts function

조회 수: 9 (최근 30일)
Rub Ron
Rub Ron 2020년 9월 8일
답변: Rub Ron 2020년 9월 10일
I have made a script which I used groupcounts() function.
The pc where the script is running is previous to 2019. So that function is not recognized. I have tried to copy the function in the path but I get this error
{Undefined variable "matlab" or class "matlab.internal.math.parseGroupVars".
Error in groupcounts (line 105)
[groupingData,groupVars] =
matlab.internal.math.parseGroupVars(T,tableFlag,'groupcounts');
is there other function that provide the same outputs but work in previous versions than 2019?

채택된 답변

Rub Ron
Rub Ron 2020년 9월 10일
I found this way. I hope someone can provide nicer way.
Original:
[xx,yy] = groupcounts(temp);
Alternative:
[xx0,yy] = findgroups(temp);
[xx,~] = histc(xx0,unique(xx0));

추가 답변 (1개)

madhan ravi
madhan ravi 2020년 9월 8일
doc groupsummary
doc splitapply
  댓글 수: 1
Rub Ron
Rub Ron 2020년 9월 9일
I am using this from, with temp is a cell array of strings. I need both oputputs. The functions you mentioned dont workfor my case
[xx,yy] = groupcounts(temp);

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by