Help on conversion of data

Please help me on it
  1. if i have 3 column of data
  2. convert the data to binary 4 bit
  3. concat it to one data to make 12 bits
  4. transpose the concated data
  5. and take it as input.
Thanks

6 comentarios

TastyPastry
TastyPastry el 20 de Oct. de 2015
Can you post a file showing more specifically what the formatting of the file, as well as the format are?
Image Analyst
Image Analyst el 20 de Oct. de 2015
What data do you have for input? Integers? In what range? What does "and take it as input" mean to you? (It means nothing to me, except maybe to pass it to a function as an input argument.)
Amit Mishra
Amit Mishra el 21 de Oct. de 2015
Dear sirs. as shown in the attached file I have data ranging between 0 to 1 in 3 columns of excel. which i want to convert to binary 4 bits separately. then i want to concat it to make a 12 bit data. After that i want to pass it to nnstart. I facing difficulty as the moment i convert it to binary it becomes Char type data. Kindly help me regards
Walter Roberson
Walter Roberson el 21 de Oct. de 2015
12 bits per row? As in a numeric array which is something high by 12 wide? Or is the 12 bits to be converted into a single integer in the range 0 to 4095 ?
Amit Mishra
Amit Mishra el 21 de Oct. de 2015
e.g. p1 has 3 columns now column 1 will be converted to 4 bit binary column 2 will be converted to 4 bit binary n same to column 3. now i want to concat it so that it will be a 12 bit binary digit.
Amit Mishra
Amit Mishra el 22 de Oct. de 2015
no response till now. plz sir

Iniciar sesión para comentar.

Respuestas (2)

Thorsten
Thorsten el 21 de Oct. de 2015
Editada: Thorsten el 21 de Oct. de 2015

0 votos

With 4 bits you can code 32 numbers, like the integers from 0 to 31. You cannot convert double precision numbers between 0 and 1 to 4 bit without loss. One way to convert would be to multiply by 32 and then use dec2bin.

6 comentarios

Amit Mishra
Amit Mishra el 21 de Oct. de 2015
kindly chk i tried this filename = 'cmtfinal.xlsx'; % Insert the file name of the file to be read from excel after the file % name and it will normalize the data for you. Sheet=1; xlrange='E2:E87'; A = xlsread(filename,Sheet,xlrange); F=MyNum2Bin(A,4,0,1); but my problem lies here in red box why is it giving us value in char? if this i can get in double .
Thorsten
Thorsten el 21 de Oct. de 2015
Please post the cmtfinal.xlsx and your MyNum2Bin function so we can have a look.
Amit Mishra
Amit Mishra el 21 de Oct. de 2015
function [y]=MyNum2Bin(x,NumOfBit, Min,Max)
P= ((x - Min) *(2^NumOfBit-1))/(Max-Min) % if P >1 % y =dec2bin(P,NumOfBit) % else % X=abs(P) % y=dec2bin(X,NumOfBit) % end % if P >1 y =dec2bin(abs(P),NumOfBit) % else % X=abs(P) % y=dec2bin(X,NumOfBit) % end
Thorsten
Thorsten el 21 de Oct. de 2015
Please post the xls file and your code to call MyNum2Bin.
Amit Mishra
Amit Mishra el 21 de Oct. de 2015
kindly chk sir
Amit Mishra
Amit Mishra el 22 de Oct. de 2015
no response till now. plz help me.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 20 de Oct. de 2015

Comentada:

el 22 de Oct. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by