A= [2 3 4]; B=[2 3 4]; Output C=[22 33 44]; Merge 2 matrix elements

HI,
I want to merge a matrix A(1xN) with B(1xN)....The elements in both matrices are same.....the output C(1xN) should merge both matrices......
Thank you

댓글 수: 1

Praveen
Praveen 2012년 11월 12일
편집: Praveen 2012년 11월 12일
A=[11 12 13] B=[11 12 13]
i want the output C = [1111 1112 1113 ; 1211 1212 1213 ; 1311 1312 1313]
help me out.... :)

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

 채택된 답변

Matt J
Matt J 2012년 11월 12일
편집: Matt J 2012년 11월 12일
C=(10.^ceil(log10(A+1))).*A + A

댓글 수: 3

thank you....its working...
Hi, A=[11 12 13]...Output C = [1111 1212 1313] But i want the output as C = [1111 1112 1113; 1211 1212 1213; 1311 1312 1313]
help me out....
Post this as a new question.

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

추가 답변 (3개)

Walter Roberson
Walter Roberson 2012년 11월 12일

0 개 추천

A*10 + B

댓글 수: 2

Harshit
Harshit 2012년 11월 12일
편집: Harshit 2012년 11월 12일
No it won't work if A have 11. Work only for single digit
HI, i want to execute 2 digits also...help me
thank you

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

Harshit
Harshit 2012년 11월 12일

0 개 추천

here it is
A= num2str(A)
B = num2str(B)
C=strcat(A',B')
C=str2num(C)

댓글 수: 1

HI, thank you... it is working for single digits..... but it is showing blank output when i execute for 2 digits.... help me out
thank you

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

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 12일
편집: Azzi Abdelmalek 2012년 11월 12일
A=[11 22 33];
c=num2str(A')
d=[c,c]
B=str2num(d)
B=B'

카테고리

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

제품

질문:

2012년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by