How can i get rows in a multidimensional array to be a new array?

Hi.
I dealing with a multidimensional array, and is a bit lost. From my multidimensional array below, i want each row to become a own array. So in my case I wish to have 9 arrays, each with dimension 1X4. So that my first array is
16.7938 0.6839 0.3873 0.2771
second is
0 0 0 0
and so on...
I was trying somthing like Gx(m,:,:), but ended up with 3rd row from each page.
Iam getting my array from these for-loops:
for j=1:Q
for m=1:N
for n=1:N
Gx(m,j,n)=Gu(n,m,j);
end
end
end
where Q=4 and N=3
Gx
Gx(:,:,1) =
16.7938 0.6839 0.3873 0.2771
0 0 0 0
0 0 0 0
Gx(:,:,2) =
16.4220 0.0000 0.0000 0.0000
3.5144 0.6839 0.3873 0.2771
0 0 0 0
Gx(:,:,3) =
16.0584 0.0000 0.0000 0.0000
3.4366 0.0000 0.0000 0.0000
3.5144 0.6839 0.3873 0.2771
Later iam going to change values for N and Q, so i wish to express my code in a generalized way. With j,m,n if possible.
Any suggestions?

 채택된 답변

Sean de Wolski
Sean de Wolski 2013년 4월 17일

0 개 추천

Why do you want this? It's much easier to just index into your multidimensional array than to have many arrays. Think about how this scales: do you want 1000 separate arrays?

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2013년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by