ORing of two Cell arrays.

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

Geoff
Geoff 2012년 3월 16일
That's not what the logical OR operator does. You mean concatenate. Is the data in each array numeric, or is it strings?

댓글을 달려면 로그인하십시오.

답변 (3개)

Walter Roberson
Walter Roberson 2012년 3월 16일

0 개 추천

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 2012년 3월 16일

0 개 추천

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

NDKA
NDKA 2012년 3월 16일
in-fact all the numbers in the Cell array's are Hex values and they are of 1 byte size.
Geoff
Geoff 2012년 3월 16일
So you mean it's binary data and you want to interleave it?

댓글을 달려면 로그인하십시오.

NDKA
NDKA 2012년 3월 16일

0 개 추천

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);

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2012년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by