Row and column of numbers in matrix

2 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)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!