# How do I convert the binary valued column to decimal?

18 views (last 30 days)
Jaykumar Vaidya on 28 Apr 2020
Commented: darova on 16 May 2020
%% bi2de
end
Error:
Error using bi2de>validateInputs (line 81)
The elements of the matrix are larger than the base can represent.
Error in bi2de (line 35)
[b_double, inType, p, msbFlag] = validateInputs(b, varargin{:});
The excel file attached has binary valued cells (columns 2,4 and 6). How can I convert those 16 bit binary bits in to decimal values?

darova on 28 Apr 2020
S X,S LogicBus,A X,A LogicBus,B X,B LogicBus
0,1.101E+15,0,1.11011E+14,0,1.11111E+15
5.32E-11,1.11111E+15,5.00E-09,1.00001E+13,5.00E-09,1.10001E+15
8.78E-11,1.01111E+15,1.00E-08,1.01E+15,1.00E-08,1.11001E+13
Don't see any binary data
Jaykumar Vaidya on 28 Apr 2020
It is a 16 bit binary data
For example:
1.01111E+15 when you see as a expanded column in excel, it will be 101111....

darova on 28 Apr 2020
Try this
A1 = table2array(A(:,2));
A2 = bin2dec(num2str(A1));

Jaykumar Vaidya on 29 Apr 2020
Done, Thanks
sarah emi on 16 May 2020
thanks for the soultion , Programming is not an easy to do . I search solution on many websites . Finally found on here . I do programming with logo designing in uae so we need some sugestion when we stuck in to problems .
darova on 16 May 2020

KSSV on 28 Apr 2020
2. Use the function bin2dec to convert binary to decimal.

Jaykumar Vaidya on 28 Apr 2020
Hi, I got this error. Cant I use xlsread?
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 1, field number 1) ==> S X,S LogicBus,A X,A LogicBus,B X,B
LogicBus\n
KSSV on 28 Apr 2020
Jaykumar Vaidya on 28 Apr 2020
I get the following error
Error using bi2de>validateInputs (line 81)
The elements of the matrix are larger than the base can represent.
Error in bi2de (line 35)
[b_double, inType, p, msbFlag] = validateInputs(b, varargin{:});