Borrar filtros
Borrar filtros

How can I find a number in a matrix?

3 visualizaciones (últimos 30 días)
Andrew
Andrew el 21 de Nov. de 2012
Comentada: Soong Yuan See el 25 de Feb. de 2020
Hi, I want to find a number in a matrix. For example, I have an array x=1:10 and I want to find a number 4 in this array and get value of cell and row in matrix. How can I do this?

Respuesta aceptada

Harshit
Harshit el 21 de Nov. de 2012
  6 comentarios
Soong Yuan See
Soong Yuan See el 25 de Feb. de 2020
ya i am also trying to check if a number appear in the array or matrix before anot.
Soong Yuan See
Soong Yuan See el 25 de Feb. de 2020
p = [11 10 2 1 5 7 4]
%check if the matrix contain number 5
contains5 = any(p(:) == 5)
if yes it will show 1 else 0
hope this is helpful

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by