Convert binary to decimat

2 ビュー (過去 30 日間)
Luqman Saleem
Luqman Saleem 2017 年 7 月 25 日
回答済み: Walter Roberson 2017 年 7 月 25 日
I have matrix A as:
A=
[11
101
110]
11, 101 and 110 here are in decimal system. But I want MATLAB to consider 11 as bits and convert them into decimals. i.e. 11=3, 101=5 and 110=6. Is there any way of doing this on a matrix of any dimension which have elements like this?

採用された回答

Walter Roberson
Walter Roberson 2017 年 7 月 25 日
bin2dec(num2str(A, '%08d'))
Note: A needs to be a column vector for this to work.

その他の回答 (1 件)

James Tursa
James Tursa 2017 年 7 月 25 日

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by