How do I convert the binary valued column to decimal?

3 ビュー (過去 30 日間)
Jay Vaidya
Jay Vaidya 2020 年 4 月 28 日
コメント済み: darova 2020 年 5 月 16 日
cadence_data = readtable('just_adder_1p2_ABS_matlab.csv','ReadVariableNames',0);
cadence_data = cadence_data{:,:};
cadence_data(1,:) = [];
%% bi2de
% [rows_A cols_A] = size(cadence_data);
cadence_data = cellfun(@str2double,cadence_data);
for i = 1:1:size(cadence_data,1)
cadence_data(i,7) = bi2de(cadence_data(i,4));
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{:});
Error in cadence_just_adder (line 15)
cadence_data(i,7) = bi2de(cadence_data(i,4));
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?
Thanks in advance
  2 件のコメント
darova
darova 2020 年 4 月 28 日
Part of your data
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
Jay Vaidya
Jay Vaidya 2020 年 4 月 28 日
編集済み: Jay Vaidya 2020 年 4 月 28 日
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
darova 2020 年 4 月 28 日
Try this
A = readtable('just_adder_1p2_ABS_matlab.csv');
A1 = table2array(A(:,2));
A2 = bin2dec(num2str(A1));
  3 件のコメント
sarah emi
sarah emi 2020 年 5 月 16 日
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
darova 2020 年 5 月 16 日
What can help you with?

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

その他の回答 (1 件)

KSSV
KSSV 2020 年 4 月 28 日
  1. Load data from csv files using csvread.
  2. Use the function bin2dec to convert binary to decimal.
  3 件のコメント
KSSV
KSSV 2020 年 4 月 28 日
Try with xlsread, readtable.
Jay Vaidya
Jay Vaidya 2020 年 4 月 28 日
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{:});
Error in cadence_just_adder (line 15)
cadence_data(i,7) = bi2de(cadence_data(i,4));

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

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by