How do I convert a 2X2 matrix to 4X4 matrix in MATLAB?

后端 未结 7 1011
無奈伤痛
無奈伤痛 2020-12-03 23:26

I need some help in converting a 2X2 matrix to a 4X4 matrix in the following manner:

A = [2 6;
     8 4]

should become:

B =         


        
7条回答
  •  长情又很酷
    2020-12-04 00:14

    Here's one more solution:

    A = [2 6; 8 4];
    B = A( ceil( 0.5:0.5:end ), ceil( 0.5:0.5:end ) );
    

    which uses indexing to do everything and doesn't rely on the size or shape of A.

提交回复
热议问题