Logical indexing in categorical array
8 次查看(过去 30 天)
显示 更早的评论
I want to ask about the logical indexing at the end. This is from Mathworks website. Looking at B(TF), it doesn't seem to convey anything meaningful. What am I missing?
5 个评论
Steven Lord
2020-8-20
You're using an older release of MATLAB. Using a cell array of char vectors rather than a string array:
rng default % So we generate the same A each time
A = randi(3, [3 3])
B = categorical(A, 1:3, {'red'; 'green'; 'blue'})
TF = B ~= 'red'
nonred = B(TF)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Categorical Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!