Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Convert Binary Representation to Matrix

Subject: Convert Binary Representation to Matrix

From: Chris

Date: 13 Apr, 2011 16:38:04

Message: 1 of 3

Done anyone know if the following is possible, programmatically?

Start with a binary representation, like: 101
End up with a vector, like: [ 1 0 1]

I do not care if the default is a horizontal or vertical vector.

Thanks.

Subject: Convert Binary Representation to Matrix

From: Sean de

Date: 13 Apr, 2011 17:12:05

Message: 2 of 3

"Chris" wrote in message <io4jhc$8c5$1@fred.mathworks.com>...
> Done anyone know if the following is possible, programmatically?
>
> Start with a binary representation, like: 101
> End up with a vector, like: [ 1 0 1]
>
> I do not care if the default is a horizontal or vertical vector.
>
> Thanks.

(num2str(101) - '0')

Subject: Convert Binary Representation to Matrix

From: ImageAnalyst

Date: 13 Apr, 2011 18:47:15

Message: 3 of 3

Or, if the 101 was a character string instead of a number:

b=['101' - '0']

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us