I have 2-D matrix having both positive and negative decimal integer I want to convert all elements of matrix to binary numbers. How can I do this?

2 ビュー (過去 30 日間)
I have 2-D matrix having both positive and negative decimal numbers I want to convert all elements of matrix to binary numbers. How can I do this?

回答 (1 件)

Image Analyst
Image Analyst 2017 年 1 月 28 日
Try this:
binaryMatrix = yourMatrix > someThreshold; % such as yourMatrix > 0 or whatever number you want.
That's a binary matrix with 0's and 1's, actually false's and true's. If you want a binary like strings, use dec2bin().
  1 件のコメント
Prachi Agarwal
Prachi Agarwal 2017 年 1 月 29 日
編集済み: Prachi Agarwal 2017 年 1 月 29 日
No, I want corresponding binary conversion for each positive and negative decimal (float) number dec2bin() works only for positive integers. my array has negative float type number also
Example Input: -14.0573255881896 -98.1397828206041 -103.920495296421 107.653286342073 14.0573255881896 -111.413032820709
Output: corresponding binary, with positive and negative numbers should have different output

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by