If function for matrix

8 vues (au cours des 30 derniers jours)
Antoni Ho
Antoni Ho le 12 Nov 2018
Commenté : Antoni Ho le 12 Nov 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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by