how to convert the floating element matrix to binary matrix ?

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 .

 採用された回答

Robert Lummert
Robert Lummert 2019 年 4 月 26 日

0 投票

It's not code, it's five chars:
a<0.5

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by