If function for matrix

9 visualizaciones (últimos 30 días)
Antoni Ho
Antoni Ho el 12 de Nov. de 2018
Comentada: Antoni Ho el 12 de Nov. de 2018
hi there
i need to do this if function
if a <= b
c = 1
else
c = realmin
but, a and b is a matrix (30x30)
and apparently i got only 1 value of c,
i want a the if function compare every cell of matrix a and b,
and gives me value in 30x30 matrix too
please help, thank you

Respuesta aceptada

madhan ravi
madhan ravi el 12 de Nov. de 2018
idx=a<b
c(idx)=1
c(~idx)=realmin
  8 comentarios
madhan ravi
madhan ravi el 12 de Nov. de 2018
+1 @Torsten - an absolut genius!!
Antoni Ho
Antoni Ho el 12 de Nov. de 2018
wow @Torsten real genius, it worked

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


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by