tabulate cell2table

조회 수: 39 (최근 30일)
Ongun Palaoglu
Ongun Palaoglu 2020년 2월 2일
답변: Walter Roberson 2020년 2월 3일
B = tabulate(A)
%2x3 cell
B = cell2table(B,'VariableNames', ...
{'Gender','Count','Percent'})
I get this error, error using cell2table (line 24) c must be a 2-d cell array.
I dont understand why i am getting this error. I am seeing resut for tabulate function 2x3 cell. can not convert it to table. cell2table function works on my different tabulate function calculation
  댓글 수: 1
Star Strider
Star Strider 2020년 2월 3일
It might be helpful to post ‘A’, since this test code works correctly:
C = {'M','F'};
X = C(randi(2, 1, 10));
B = tabulate(X);
B = cell2table(B,'VariableNames', ...
{'Gender','Count','Percent'})

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

채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 3일
You would get that error if A was a numeric vector, in which case B would be a numeric output array rather than a cell array. Then the numeric array would be a problem when passed to cell2table()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by