Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have 468 by 1 matrix of floating data. I need to convert it to binary with same dimensions, e.g., 468 by 1. Kindly help

1 回表示 (過去 30 日間)
-1.9836
-0.0287
-0.4330
0.7517
-0.4883
-0.1712
0.2263
0.7347
.... 400+ rows here
-0.5308
-0.5600
-0.5302
-0.3920
-0.0819
-0.3893
-0.6267
0.0062
-0.2508
0.8580
0.2292
0.0196
-1.3797
-0.6845
-0.2160
convert it binary with same matrix dimensions
  3 件のコメント
Stephen23
Stephen23 2018 年 11 月 7 日
編集済み: Stephen23 2018 年 11 月 7 日
@Guilalume: well, the numeric data shown in the question is already a binary array, and seems to fulfill all of the requirements so far. Perhaps the question was asked without realizing that numeric arrays are already binary...
Guillaume
Guillaume 2018 年 11 月 7 日
Yes, I think it's a case of the OP not knowing what binary is. However, considering the complaint that Kalyan's answer generates an 8 column matrix, it does look like the OP is after a column vector of 0 and 1.

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 11 月 7 日
編集済み: KALYAN ACHARJYA 2018 年 11 月 7 日
Hope this is helpful, for example
a=[-1.23;-2.54;-1.50]
a =
-1.2300
-2.5400
-1.5000
>> d=dec2bin(typecast(int8(a),'uint8'))
d =
11111111
11111101
11111110
  7 件のコメント
James Tursa
James Tursa 2018 年 11 月 7 日
編集済み: James Tursa 2018 年 11 月 7 日
You need to give us an explicit example of what you mean by a "double binary" type. Technically, MATLAB stores the double value in floating point binary already, so what is it that you actually want? E.g., if the double value is 1.5 then what would be your desired output?
Stephen23
Stephen23 2018 年 11 月 7 日
編集済み: Stephen23 2018 年 11 月 7 日
@Sajid Sarwar: I guess you did not read my request. Here is what I asked you:
Please give us an example of a "double(binary) value". Show us one.

その他の回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by