Borrar filtros
Borrar filtros

Converting an n x m matrix into a single array

1 visualización (últimos 30 días)
Ernest Modise - Kgamane
Ernest Modise - Kgamane el 27 de Mzo. de 2021
Respondida: DGM el 27 de Mzo. de 2021
I have the following
source = [8202, 8202, 8202, 8201, 8202, 8202, 8202, 8208];
I want to have an array containing the binary values of source but as a single array,
Array = ( de2bi(8202) de2bi(8202) .... de2bi(8206))
so that I can index the resultant bits of the eight entries one by one,
I am essentially trying to obtain a complete bit stream of source data in one array so that I can work with the individual bits
In this case I am expecting an array with 8 * ceil(log2(max(source)))
Kindly assist,

Respuesta aceptada

DGM
DGM el 27 de Mzo. de 2021
How about something like this?
source = [8202, 8202, 8202, 8201, 8202, 8202, 8202, 8208];
sbin=de2bi(source,'left-msb'); % pick which bit order you need
bitstream=reshape(sbin',[1 numel(sbin)]) % reshape into a vector

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by