How to create a 2x2 matrix?

조회 수: 326 (최근 30일)
Gn Gnk
Gn Gnk 2019년 12월 4일
편집: Adam Danz 2019년 12월 4일
Hello ,
i want to create a 2x2 matrix like that :
, h is 2x500 matrix .
So , i have to create a 2x2 matrix that each cell contains 2x500 matrix
I tried to write:
M = [h(1,:) h(2,:) ; h(2,:) h(1,:)]
But that ends up with a 2x1000 matrix .
What should i do ?
*Note that h is a complex array
thank you.

채택된 답변

Adam Danz
Adam Danz 2019년 12월 4일
편집: Adam Danz 2019년 12월 4일
Use curly brackets instead of square brackets.
M = {h(1,:) h(2,:); h(2,:) h(1,:)};

추가 답변 (1개)

Raj
Raj 2019년 12월 4일
h1=rand(2,500)+i*rand(2,500) % Your first matrix
h2=rand(2,500)+i*rand(2,500) % Second matrix
M=[{h1} {h2};{h2} {h1}]

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by