how to compare each element of matrix?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
here...i taken some variable as t ,value is 4(t=4),and f is a 4x4 matrix.. f=[1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5].. how to compare the each element of matrix with T?
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 10 de En. de 2013
Editada: Andrei Bobrov
el 10 de En. de 2013
t = 4;
f = [1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5];
out = abs(f - t) < eps(100)
ADD
out = f;
out(f <= t) = -4;
6 comentarios
Andrei Bobrov
el 10 de En. de 2013
Editada: Andrei Bobrov
el 10 de En. de 2013
out = t*((f > t)*2-1)
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!