WHY LOGICAL INDEXING REDUCE TOTAL ROW COUNT
Show older comments
Dear MATLAB,
I notice strange thing happen when use logical indexing. Specifically, the number of row is reduced.
Is this a bug? I am using MATLAB2017a
Thanks in advance for any insight.
The code are as follow
load('help_ismember'); % attached together with this question
NonNanPVT_Logic=ismember(Validtn_Loc,Validtn_Loc_MIA); % 37 row
KSS_valid_WithNan(NonNanPVT_Logic==0)=ev.KSS_valid(NonNanPVT_Logic==0); %Output reduced to 36
2 Comments
Stephen23
on 8 Mar 2019
"Is this a bug?"
Not really, This behavior is easy to demonstrate:
>> X = [true,true,false,false];
>> A(X) = 3
A =
3 3
What size would you expect A to be?
polo sepian
on 14 Mar 2019
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!