Reshaping Multiple Matrices

조회 수: 12 (최근 30일)
robin mooney
robin mooney 2011년 2월 3일
Hi,
I am trying to reshape 1081 column vectors (size 49x1 each) using a for loop.
I know the loop needs to go from i=1 to i=1081. And the reshape command should look something like this;
T1= reshape(T1,7,7)
However I cannot seem to figure the correct loop for this.
The column vectors are named T0, T1, T3, .... , T1079, T1080.
Can anyone help me with this?
Many thanks
robin ----- Dublin Institute of Technology

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 2월 3일
  댓글 수: 2
robin mooney
robin mooney 2011년 2월 3일
thanks Sean. This info was indeed helpful!
However I am having trouble applying a formula to reshape the matrices within the loop. I tried T(i)=reshape(T(i),7,7) within the loop but it is not working. I'm a little fresh to matlab so excuse my ignorance if i am doing something simple wrong!
thanks
robin
the cyclist
the cyclist 2011년 2월 3일
For the index, use curly bracket T{i} rather than parentheses.

댓글을 달려면 로그인하십시오.


the cyclist
the cyclist 2011년 2월 3일
Also, if you can concatenate all your original vectors into one large array, then you can do the reshape in one fell swoop:
>> T = rand(1081,49); % Size of all your vectors, concatenated
>> Tr = reshape(T,[7,7,1081]); % Each slice in 3rd dim is one of your 7x7
  댓글 수: 1
robin mooney
robin mooney 2011년 2월 7일
thanks cyclist! I will try this out!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by