how to ease conditions?

1 visualización (últimos 30 días)
Ani Asoyan
Ani Asoyan el 11 de Mayo de 2020
Comentada: Ani Asoyan el 11 de Mayo de 2020
Hi .. In my code I have a result number (called "gov") on which I want to put conditions
also there is a matrix with 25 columns and 5 rows (called "gp") and a parameter "d"
if gov= one of the values of the first 5 colums of gp (doesn't matter which row)
d=d+1
end
how can I write that easily and short, without typing all the rows and colums?

Respuesta aceptada

Image Analyst
Image Analyst el 11 de Mayo de 2020
Try ismember()
if ismember(gov, gp(:, 1:5))
d = d + 1;
end
  1 comentario
Ani Asoyan
Ani Asoyan el 11 de Mayo de 2020
Thank you so much !

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by