필터 지우기
필터 지우기

Combining vectors [1 2 3 4 5] and [2 3 4 1 5] to [12 23 34 41 55]

조회 수: 1 (최근 30일)
Redstein
Redstein 2019년 3월 19일
편집: Andrei Bobrov 2019년 3월 19일
Hi everybody,
I want to combine two vectors to one, but am not able to find an equivalent example.
I have two vectors that I want to combine as following:
[1 2 3 4 5] and [2 3 4 1 5] to [12 23 34 41 55]
Is there an elegant way to code this?
Thanks a lot!

채택된 답변

Torsten
Torsten 2019년 3월 19일
편집: Torsten 2019년 3월 19일
v = 10*v1 + v2

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2019년 3월 19일
편집: Andrei Bobrov 2019년 3월 19일
A = [1 200 3 4 5];
B = [23 3 445 10 54];
out = str2double(string(A)+B);
or
out = A.*10.^(floor(log10(B))+1) + B;

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by