Row and column of numbers in matrix

3 visualizzazioni (ultimi 30 giorni)
armin m
armin m il 26 Nov 2021
Commentato: armin m il 26 Nov 2021
Hi. I wanna find row and column of specific number. Tnx

Risposta accettata

Adam Danz
Adam Danz il 26 Nov 2021
Modificato: Adam Danz il 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)

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by