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

后端 未结 7 1014
無奈伤痛
無奈伤痛 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:05

    Can be done even easier than Jason's solution:

    B = A([1 1 2 2], :);  % replicate the rows
    B = B(:, [1 1 2 2]);  % replicate the columns
    

提交回复
热议问题