필터 지우기
필터 지우기

how to concatenate array of different size

조회 수: 1 (최근 30일)
aditya kumar sahu
aditya kumar sahu 2016년 11월 13일
댓글: Walter Roberson 2016년 11월 14일
is it possible to concatenate two array elements of various size, suppose an elements of an array c(1,1)=101010 (let 'c' is 256*8 size) and the elements of other array is d(1,1)=11 (let 'd' is 2*3 size) i want p(1,1)= 11101010..is it possible if yes plz suggest me.. Thank you in advance.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 11월 13일
num_places = max( ceil(log10(d(:)+1)) );
c(1:size(d,1), 1:size(d,2)) = c(1:size(c,1), 1:size(c,2)) * 10.^num_places + d;
  댓글 수: 2
aditya kumar sahu
aditya kumar sahu 2016년 11월 14일
but it is coming error "Error using + " "as matrix dimension should agree"
Walter Roberson
Walter Roberson 2016년 11월 14일
num_places = max( ceil(log10(d(:)+1)) );
c(1:size(d,1), 1:size(d,2)) = c(1:size(d,1), 1:size(d,2)) * 10.^num_places + d;

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

Community Treasure Hunt

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

Start Hunting!

Translated by