How can i get rows in a multidimensional array to be a new array?
4 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
Sean de Wolski
2013 年 4 月 17 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!