annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Binary string to binary number conversion

Résolu !
Accéder à la solution

Hello guys, sorry to bother you and thanks for watching over here.

 

I am currently doing the conversion from string to a binary number(I have string like1001000110 which is binary, what I'd like to do is passing the exact same value of the binary number from the string)

What I am getting the value from the 'Fract/Exp string to number' function now is '1E+10', is there any way to pass the exact same value in the string rather than 1E+10?

shot.PNG

0 Compliments
Message 1 sur 18
6 718 Visites

Instead of "Fract/Exp string to number", you should use "Scan From String" with %b to signify binary input:

snippet.png

Message 2 sur 18
6 685 Visites

You can try something like this:

Capture.PNG

Message 3 sur 18
6 675 Visites

Of course, IIRC, both don't adapt to arrays (sadly). You'd need a for loop around them.

 

If the entire file is binary, you can try this:

Spreadsheetstring to binary.PNG

Easier and more flexible, IMHO.

Message 4 sur 18
6 617 Visites

Thanks for your replies!

 

As you can see, what I am using now is 'index array' to separate values in two columns, and the purpose for this is to make a lookup table, so after the 'filter' which is index array, it will give two 1D arrays from that, while 'scan from string' can not accept 1D array of string.

Here is the content in the txt file, so maybe you can have a look.Smiley clignant de l'œil

content.PNG

0 Compliments
Message 5 sur 18
6 605 Visites

Thanks for the data, it is easier to help with that.
I guess combining Gregory's or prettypwnie's suggestion with wiebe@CARYA's remark about for loop would be the solution.

Capture.PNG

Message 6 sur 18
6 565 Visites

Hi RolfO,

Thanks for your reply!

But it is strange that I pass the value after the 'scan value' function, the binary string turns to decimal somehow... Is there anything that I need to be aware?scan value.PNG

In the graph, value is coming out of the scan value and String 2 is the binary string.

0 Compliments
Message 7 sur 18
6 538 Visites
Solution
Accepté par l'auteur du sujet AlEXINUK

@AlEXINUK wrote:

Hi RolfO,

Thanks for your reply!

But it is strange that I pass the value after the 'scan value' function, the binary string turns to decimal somehow... Is there anything that I need to be aware?scan value.PNG

In the graph, value is coming out of the scan value and String 2 is the binary string.


Not sure what's happening, but I can guess.

 

You convert the string to a number, using Scan From String or Scan Value. The result is a number. This number will show decimally, by default. If you want it to display it's value binary, you have to format it binary (right click the indicator, Display Format).

Message 8 sur 18
6 529 Visites

The binary number 00000011100 is exactly the same as decimal number 28. Its only the presentation which differs because the number base is different. The same number in hex base is 1C

 

If you as an example use the function "Format into string" with format "%d" you will get a decimal number without decimals. 

"%f" gives the number in decimal representation with decimals. "%x", "%o" and "%b" gives a string with hex, octal and binary representation.

And as wiebe@CARYA said, you have the possibility to change how a number is presented in numeric indicators and controls. There also is a possibility to make the radix visible. This will indicate which radix/base the indicator/control uses for presenting the number.

0 Compliments
Message 9 sur 18
6 511 Visites

Thanks for your advice and it works!

But binary string turns from 00000011100 to 11100, is there any solutions for this?

And also, in@rolfO's reply,  turns the indicator after the scan value to array type, could you please tell me how to change that as well? The default type is not array and I can't find this in display format.

 

Thanks for your patience!

0 Compliments
Message 10 sur 18
6 498 Visites