How can I write a function that takes as input a vector of 8 bit signed integer in twos-complement and represen the negation of the input
2 ビュー (過去 30 日間)
古いコメントを表示
How can I write a function that takes as input a vector of length eight containing 0s and 1s and representing an 8 bit signed integer in twos-complement. The function should return a vector of eight 0s and 1s representing the negation of the input.
note: I'm not allowed to use loops
1 件のコメント
Varun Baskar
2020 年 6 月 8 日
Hi Sean,
Have you found an answer for this? Am looking for the exact same step.
Thanks and regards
回答 (1 件)
Iain
2014 年 3 月 4 日
bin2dec, can turn a binary string into a decimal number. I suggest you then cast it as:
int8
dec2bin can then turn a decimal number into a binary string.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!