Borrar filtros
Borrar filtros

ORing of two Cell arrays.

1 visualización (últimos 30 días)
NDKA
NDKA el 16 de Mzo. de 2012
Hi,
I know this may be a basic question. I have two Cell arrays. For example, 'A1' as <1000x1 cell> 'A2' as <1000x1 cell> Now, I'd like to OR both of them in to a single Cell.
like C = A1 | A2;
if A1 = 23, A2 = 56, then I want C = 2356;
Can anyone tell how do I do that?
Thanks
  1 comentario
Geoff
Geoff el 16 de Mzo. de 2012
That's not what the logical OR operator does. You mean concatenate. Is the data in each array numeric, or is it strings?

Iniciar sesión para comentar.

Respuestas (3)

Walter Roberson
Walter Roberson el 16 de Mzo. de 2012
That does not look like "or" to me. That looks like concatenation of decimal numbers.
What if the numbers stored have fractions? What if some of them are negative?
What if some of the cells have strings? Or NaN? Or contain structures? Or contain further cell arrays?
What if the cell arrays are not the same length?

NDKA
NDKA el 16 de Mzo. de 2012
All the numbers are not fractions and negative. But, they have strings (i.e. hex values).
Its like
A1 = [23 A1 45 FE 01]
A2 = [23 A1 45 09 FE]
  2 comentarios
NDKA
NDKA el 16 de Mzo. de 2012
in-fact all the numbers in the Cell array's are Hex values and they are of 1 byte size.
Geoff
Geoff el 16 de Mzo. de 2012
So you mean it's binary data and you want to interleave it?

Iniciar sesión para comentar.


NDKA
NDKA el 16 de Mzo. de 2012
Yes Walter, as you said, its Concatenation. I used the following command, and its working pretty fine for me. Thanks to you.
C = strcat(A1, A2);

Categorías

Más información sobre Matrices and Arrays 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