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

1 Ansicht (letzte 30 Tage)
Praveen
Praveen am 12 Nov. 2012
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 Kommentar
Praveen
Praveen am 12 Nov. 2012
Bearbeitet: Praveen am 12 Nov. 2012
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.... :)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 12 Nov. 2012
Bearbeitet: Matt J am 12 Nov. 2012
C=(10.^ceil(log10(A+1))).*A + A
  3 Kommentare
Praveen
Praveen am 12 Nov. 2012
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....
Matt J
Matt J am 12 Nov. 2012
Post this as a new question.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Walter Roberson
Walter Roberson am 12 Nov. 2012
A*10 + B
  2 Kommentare
Harshit
Harshit am 12 Nov. 2012
Bearbeitet: Harshit am 12 Nov. 2012
No it won't work if A have 11. Work only for single digit
Praveen
Praveen am 12 Nov. 2012
HI, i want to execute 2 digits also...help me
thank you

Melden Sie sich an, um zu kommentieren.


Harshit
Harshit am 12 Nov. 2012
here it is
A= num2str(A)
B = num2str(B)
C=strcat(A',B')
C=str2num(C)
  1 Kommentar
Praveen
Praveen am 12 Nov. 2012
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

Melden Sie sich an, um zu kommentieren.


Azzi Abdelmalek
Azzi Abdelmalek am 12 Nov. 2012
Bearbeitet: Azzi Abdelmalek am 12 Nov. 2012
A=[11 22 33];
c=num2str(A')
d=[c,c]
B=str2num(d)
B=B'

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by