I have 5 strings (hex) which look like this:
a = 40 C0 70 EB;
b = 40 C0 80 94;
c = 40 C0 90 59;
d = 40 C0 A0 13;
e = 40 C0 B0 DE
I need to extract each column (vertical values) starting from the last then save it into a string and then convert it into its equivalent binary. I hope the figure below gives a clear picture.
I was able to convert the given hex to binary values horizontally one at a time, but now I would like to extract them vertically and then convert them to binary. The code which I have written is as follows,
Data = '40 C0 70 EB';
str = regexp(Data,' ','split');
Ind = cellfun(@length,str);
str=str(Ind==2);
%Hex to Binary
bin = hexToBinaryVector(str,8,'MSBFirst');
Desired output: When the values in the first column(input) are retrieved they should be converted into binary and stored as an array(output). For instance, for 1st column (red), we have values 'EB 94 59 13 DE' its equivalent binary is ['1001 0100' '1001 0101' '1001 0110' '1001 0111' '1001 1000' '1001 1001']. Therefore, all these binary values must be stored as an array under one variable. Similarly, others should also be stored as an array under different variables.
regexp(Data,' ','split');
do the same asstrsplit(Data)
? – Adriaan