Error when assigning categories to a tall array

I ran into a wiered problem for me as when I tried to assign categories to a tall array, it failed while it went through if I used the gathered version. See attached a small dataset as a test dataset (only 100 strings), and below a working example:
% test
load('testSmall.mat');
code = "1";
meaning = "test";
res = categorical(testSmall, code, meaning); % ok
testTall = tall(testSmall);
res2 = categorical(testTall, code, meaning); % error occurred
The error message:
Error using categorical (line 528)
VALUESET must be numeric when DATA is numeric.
Error in tall/categorical>iGetOutputAdaptor (line 89)
localData = categorical([], extraArgs{:}, varargin{idx:end});
Error in tall/categorical (line 44)
outAdaptor = iGetOutputAdaptor(tdata,varargin{:});
It happened that when I nevigate into the categorical function, the first parameter (inputData) was always empty when I use the tall array testTall as the input. Why this happens?

 채택된 답변

Sean de Wolski
Sean de Wolski 2020년 3월 31일

0 개 추천

That also appears to be a bug in how tall handles scalar strings for cats and values. If you make code and meaning into vectors it works fine. Here I give them a dummy value:
code = ["1" "2"];
meaning = ["test" "answer"];
res = categorical(testSmall, code, meaning); % ok
testTall = tall(testSmall);
res2 = categorical(testTall, code, meaning);
I'll report this one to development as it's completely reproducible.

댓글 수: 11

Peng Li
Peng Li 2020년 3월 31일
yeah Thanks Sean. as long as there are more than two elements, it works perfectly. I can do this but it is just annoying for me given this code bug.
Peng Li
Peng Li 2020년 3월 31일
So all my three questions are related. I've kind of solved the second and the third. My first is still hanging there. Any suggestion please? Without solving this, I just couldn't get my hands on this dataset. Instead, I'm working on a subset these days to get the program for other processings moved on.
I (we) really need a few rows of representative data to help you any further with the original question.
Peng Li
Peng Li 2020년 3월 31일
understand. I'm wondering if it's fine if I sent you a subset privately?
Sure. Message me >>char([115 100 101 119 111 108 115 107 64 109 97 116 104 119 111 114 107 115 46 99 111 109]) and I can send you a secure file transfer link.
Peng Li
Peng Li 2020년 3월 31일
yeah great! messaged you with a dropbox link (hope this is secure as well lol).
Sean de Wolski
Sean de Wolski 2020년 4월 1일
편집: Sean de Wolski 2020년 4월 1일
I haven't recieved it; I think my spam filter blocks dropbox links!
Peng Li
Peng Li 2020년 4월 6일
Sorry Sean. Just saw your reply. I'll drop you an email again.
Peng Li
Peng Li 2020년 4월 13일
Sean, any chance that you received my new email?
I have not. I just checked my spam filter as well and verified that the email from the MATLAB command above works.
sent

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Categorical Arrays에 대해 자세히 알아보기

질문:

2020년 3월 25일

댓글:

2020년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by