Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- how to convert binary data into ascii codes

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 15, 2014 1:40 PM
(7254 views)

I have some analog data I need to convert it to binary basing on its value(done). Then I managed to put 8 bits together to make a binary data by jmp script. Where I need help is how to convert the binary data into text/number using ascii codes. I tried use blob to char but it reporting wrong data type....

I attached jmp table.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

The binary numbers in your table do not always correspond to A-Z or 0-9. These show up: " # & 0 1 2 3 4 5 6 7 ? @ A B C D E F G H I J K L M N P Q R S T U V W X _ o { } ~

And in the many cases of non-printable ascii "characters" there will be empty cells in JMP.

I've probably misunderstood your goal, but try this formula, which will make an exception for all wl among {12, 13, 26, 27, 40, 41}.

If**(** Contains**(** **{****12**, **13**, **26**, **27**, **40**, **41****}**, :wl **)**,

Char**(**

**(**Matrix**(**

**{**:Name**(** "0" **)**, :Name**(** "1" **)**, :Name**(** "2" **)**, :Name**(** "3" **)**, :Name**(** "4" **)**,

:Name**(** "5" **)**, :Name**(** "6" **)}**

**)**` * **2** ^ Index**(** **0**, **6** **)**`**)[****1****]**

**)**,

Hex To Char**(**

Right**(**

Hex**(**

**(**Matrix**(**

**{**:Name**(** "0" **)**, :Name**(** "1" **)**, :Name**(** "2" **)**, :Name**(** "3" **)**,

:Name**(** "4" **)**, :Name**(** "5" **)**, :Name**(** "6" **)}**

**)**` * **2** ^ Index**(** **0**, **6** **)**`**)[****1****]**,

"integer"

**)**,

**2**

**)**,

"us-ascii"

**)**

**)**

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: how to convert binary data into ascii codes

There is probably a simpler way, but try to paste the code below into a column formula field in the posted data table. It should give the ascii character (the first argument of Hex() alone calculates the ascii decimal code)

Hex To Char**(**

Right**(**

Hex**(**

**(**Matrix**(**

**{**:Name**(** "0" **)**, :Name**(** "1" **)**, :Name**(** "2" **)**, :Name**(** "3" **)**, :Name**(** "4" **)**, :Name**(** "5" **)**, :Name**(** "6" **)} ****)**` * **2** ^ **[****0**, **1**, **2**, **3**, **4**, **5**, **6****])[****1****]**,

"integer"

**)**,

**2**

**)**,

"us-ascii"

**)**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: how to convert binary data into ascii codes

Thanks MS!

I know nothing about matrix usage in jmp. for the data I posted, my ultimate goal are A: convert "wl" 0~11, 14~25 and 28~39 to text composing A-Z and 0-9. B: Other "wl"s represent a 2 digit decimal number.

your script work for A but not for B.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

The binary numbers in your table do not always correspond to A-Z or 0-9. These show up: " # & 0 1 2 3 4 5 6 7 ? @ A B C D E F G H I J K L M N P Q R S T U V W X _ o { } ~

And in the many cases of non-printable ascii "characters" there will be empty cells in JMP.

I've probably misunderstood your goal, but try this formula, which will make an exception for all wl among {12, 13, 26, 27, 40, 41}.

If**(** Contains**(** **{****12**, **13**, **26**, **27**, **40**, **41****}**, :wl **)**,

Char**(**

**(**Matrix**(**

**{**:Name**(** "0" **)**, :Name**(** "1" **)**, :Name**(** "2" **)**, :Name**(** "3" **)**, :Name**(** "4" **)**,

:Name**(** "5" **)**, :Name**(** "6" **)}**

**)**` * **2** ^ Index**(** **0**, **6** **)**`**)[****1****]**

**)**,

Hex To Char**(**

Right**(**

Hex**(**

**(**Matrix**(**

**{**:Name**(** "0" **)**, :Name**(** "1" **)**, :Name**(** "2" **)**, :Name**(** "3" **)**,

:Name**(** "4" **)**, :Name**(** "5" **)**, :Name**(** "6" **)}**

**)**` * **2** ^ Index**(** **0**, **6** **)**`**)[****1****]**,

"integer"

**)**,

**2**

**)**,

"us-ascii"

**)**

**)**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: how to convert binary data into ascii codes

thanks MS.

Sorry, in fact that I realized later that "wl" 0~11, 14~25 and 28~39 are 2 digits decimal number, which only need be convert to decimal.