MATLAB Answers

Error when assigning categories to a tall array

4 views (last 30 days)
Peng Li
Peng Li on 25 Mar 2020
Commented: Sean de Wolski on 14 Apr 2020
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?

  0 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 31 Mar 2020
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 Comments

Show 8 older comments
Peng Li
Peng Li on 13 Apr 2020
Sean, any chance that you received my new email?
Sean de Wolski
Sean de Wolski on 14 Apr 2020
I have not. I just checked my spam filter as well and verified that the email from the MATLAB command above works.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by