I wanna create a specific matrix B from a regular matrix A as following in Matlab. Is there anyone who can help me to use a better method to generate it, not for loop? The matrix size could be various. In example, it's 3 by 3 matrix. It could be 3 by n matrix. Thanks
A=[ a b c; d e f; g h i]B=[a 0 0; d b 0; g e c; 0 h f; 0 0 i]
Best Answer