If function for matrix

8 visualizzazioni (ultimi 30 giorni)
Antoni Ho
Antoni Ho il 12 Nov 2018
Commentato: Antoni Ho il 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

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Tag

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by