how to convert the floating element matrix to binary matrix ?

10 vues (au cours des 30 derniers jours)
a=[ 0.360 0.9216 0.2890 0.8219 0.5854 0.9708 0.1133 0.4020;
0.9616 0.1478 0.5039 0.9999 0.0002 0.0010 0.0039 0.0157;
0.0617 0.2317 0.712 0.8200 0.5904 0.9673 0.1264 0.4416;
0.9864 0.0537 0.2034 0.6481 0.9122 0.3203 0.8709 0.4498;
0.9899 0.0400 0.1535 0.5199 0.9984 0.0063 0.0251 0.0979;
0.3533 0.9139 0.3148 0.8628 0.4736 0.9972 0.0111 0.0440;
0.1684 0.5600 0.9856 0.0568 0.2144 0.6738 0.8792 0.4249;
0.9778 0.0881 0.3214 0.8724 0.4453 0.9880 0.0473 0.1804]
The above matrix need to be converted to binary matrix with the condition,
if the element of the matrix is <0.5 that should be resulted as 0,
else the result should be 1. plz help us to write the matlab code for this .

Réponse acceptée

Robert Lummert
Robert Lummert le 26 Avr 2019
It's not code, it's five chars:
a<0.5

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by