Row and column of numbers in matrix

3 views (last 30 days)
armin m
armin m on 26 Nov 2021
Commented: armin m on 26 Nov 2021
Hi. I wanna find row and column of specific number. Tnx

Accepted Answer

Adam Danz
Adam Danz on 26 Nov 2021
Edited: Adam Danz on 26 Nov 2021
[rowNum, colNum] = find(matrix == value)
Or, if you're working with floating point decimals,
[~, minIdx] = min(abs(matrix - value));
[rowNum, colNum] = ind2sub(size(matrix), minIdx)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!