Table/categorical arrays and the <undefined> category

5 ビュー (過去 30 日間)
Phillip
Phillip 2014 年 6 月 3 日
コメント済み: dpb 2014 年 6 月 4 日
Hi
I create a table with different data. Some of the data I set as categorical arrays as such:
table.field = categorical(table.field);
This works fine. When there are NaNs or empty strings within table.field matlab automatically assigns '<undefined>' to those. Also not a problem. However, when I do a unique on them, each '<undefined>' is seen as unique instead of the same. The only way I see around this is to do something like:
table.field(isundefined(table.field)) = 'None';
That seems like a hack. Surely is must be possible to specify what the undefined "label" is in the syntax call?
Hope I'm missing something, Regards, Phil
  3 件のコメント
Phillip
Phillip 2014 年 6 月 4 日
Hi
Thanks for pointing that out. I did miss that function. Although it seems that it does the opposite to what I want. It takes non-standard inputs and changes it into the standard missing variables which is undefined etc. Still wouldn't solve my uniqueness problem.
dpb
dpb 2014 年 6 月 4 日
I may have misinterpreted--my thought was perhaps one could use the function to force the missing value and that internally that might just cause the symptom to go away.
I still recommend this be submitted to "official" support for resolution of whether it is intended behavior or not--it seems wrong-headed if so on the face of it. Perhaps TMW has a reason we're not seeing, but I'd guess it's a fignewton of an implementation detail and isn't really thought out as of yet.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeBar Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by