Logical indexing returns different dimensions
Show older comments
a = [3, 2]
b = [1; 1] == 1
a(b) % returns a 1x2 array
a = [3, 2; 4, 5]
b = [1; 1; 1; 1] == 1
a(b) % returns a 4x1 array
1 Comment
Umesh Kumar Singla
on 12 Jan 2023
Edited: Umesh Kumar Singla
on 12 Jan 2023
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!