How to concatenate matrices horizontally?

前端 未结 2 545
孤街浪徒
孤街浪徒 2021-01-26 02:36

I have two 3-by-3 matrices:

A= [ 1 2 3 
     1 1 1
     0 1 1] 

B= [ 1 2 1 
     1 1 1
     2 2 2]

How do I concatenate the

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-26 02:54

    There are a few possibilities here. The easiest, and most common one:

    concat = [A, B]
    

    The following is considered more robust by some, (because one might, on accident, do concat = [A; B], which would concatenate them vertically):

    concat = horzcat(A, B)
    

提交回复
热议问题