Code covered by the BSD License  

Highlights from
Converting between text strings and binary vectors

5.0

5.0 | 1 rating Rate this file 38 Downloads (last 30 days) File Size: 1.98 KB File ID: #18072

Converting between text strings and binary vectors

by Rick Rosson

 

19 Dec 2007 (Updated 20 Dec 2007)

Functions to convert from text strings to binary vectors and back again.

| Watch this File

File Information
Description

This zip file contains two functions: STR2BIN converts an ASCII text string to a vector of binary values, and BIN2STR converts a vector of binary values back to an ASCII text string.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
11 Apr 2008 Mohammad kh  
30 Mar 2009 Vishaka

You have introduced a lot of unnecessary conversions in your code for converting from string to vector:
This line suffices for doing the conversion:
binVec = uint8(binStr) - uint8('0');
If you want a double vector, you can just do a double(binVec).

Please login to add a comment or rating.
Updates
20 Dec 2007

Added examples to the help for each function.

Tag Activity for this File
Tag Applied By Date/Time
strings Rick Rosson 22 Oct 2008 09:39:55
convert Rick Rosson 26 Jan 2009 15:04:16
data type Rick Rosson 26 Jan 2009 15:04:38
binary Rick Rosson 26 Jan 2009 15:04:38
text string Rick Rosson 26 Jan 2009 15:04:38
text Rick Rosson 26 Jan 2009 15:04:52
utility Rick Rosson 26 Jan 2009 15:05:07
ascii Rick Rosson 26 Jan 2009 15:05:50
bits Rick Rosson 08 Apr 2009 23:11:06
bit stream Rick Rosson 08 Apr 2009 23:11:06
symbols Rick Rosson 08 Apr 2009 23:11:27
communications Rick Rosson 08 Apr 2009 23:11:27
convert Ashish Soni (JUET, Guna) 26 Apr 2011 05:28:10
binary Ashish Soni (JUET, Guna) 26 Apr 2011 05:28:13
ascii Nikhilkumar 12 May 2011 07:40:15
ascii dads PB 06 Jun 2011 03:30:17
bit stream Felix 30 Sep 2011 09:37:24
binary Falah 21 Oct 2011 15:20:46

Contact us at files@mathworks.com