필터 지우기
필터 지우기

A general question of matrix to matrix

조회 수: 1 (최근 30일)
Martin
Martin 2015년 8월 12일
댓글: Martin 2015년 8월 12일
Hello buddies,
I have 2 matrices:
a = [ 1 2 3; 4 5 6 ]
b = [ 9 9 9; 9 9 9 ]
I'm wondering if there is a function, or an CPU non-burdensome way to get the following result:
c = [ 1 9 2 9 3 9 ; 4 9 5 9 6 9 ]
Right now I do it with for loop, but it take ALOT of time!
Any help will be very appreciated, thanks.
Have a good day,
-best

채택된 답변

Adam
Adam 2015년 8월 12일
편집: Adam 2015년 8월 12일
reshape( [a; b], [2 6] )
with obvious generalisations for different sizes of vector and assumptions on a and b having the same dimensions
  댓글 수: 1
Martin
Martin 2015년 8월 12일
thanks :) now I can delete 90% of my script

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by