Borrar filtros
Borrar filtros

How to find the row and column number in a table

1 visualización (últimos 30 días)
Meriem Mouelhi
Meriem Mouelhi el 4 de En. de 2018
Respondida: Abhishek Tiwari el 30 de Jun. de 2022
I want to find the row and column number in a table for expemple A=[1 13 4 7 5 10 21] What is the row and column of 7

Respuestas (1)

Abhishek Tiwari
Abhishek Tiwari el 30 de Jun. de 2022
Hi,
It can be done with a simple conditional expression and find(). The conditional statement will convert your vector to a binary vector, and then find() will locate all the values that are 1. Here's an example:
A = [1 13 4 7 5 10 21];
[row, column] = find(A==7)
row = 1
column = 4

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by