concatination rows of matrix for making a new matrix

1 visualización (últimos 30 días)
zahra hatami
zahra hatami el 2 de Dic. de 2020
Comentada: zahra hatami el 2 de Dic. de 2020
Hi.i have a matrix(1000 * 64) that is filled with 1 and 0 .i wanna to concatinate bits of rows to make a matrix 1000 * 1 .i dont know how to do it:(

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 2 de Dic. de 2020
If you want to pack the bits to create a vector of uint64 datatype then try this
M = randi([0 1], 1000, 64); % random vector
M_new = uint64(M);
x = uint64(2).^uint64(63:-1:0);
M_new = sum(M_new.*x,2,'native');

Más respuestas (1)

KSSV
KSSV el 2 de Dic. de 2020
% Data for demo
A = [0 0 1 1 0 0 0
0 0 1 1 0 0 1
0 0 1 0 0 0 0];
iwant = char(A+'0');
  2 comentarios
Ameer Hamza
Ameer Hamza el 2 de Dic. de 2020
But it is still 3x7 matrix. This only changes the type to char.
KSSV
KSSV el 2 de Dic. de 2020
I think OP wants to convert 1000*64 1, 0's matrix to binary representation.

Iniciar sesión para comentar.

Categorías

Más información sobre Numeric Types 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