Change table variable dimension
조회 수: 6 (최근 30일)
이전 댓글 표시
I have two multi-diemnsional array to be merged into a Table.
A : K x M x N x L array
B : K x M x N array
If I do table(A,B), it resulted in two columns with K rows as follows
Var1 Var2
--------------------- -------------------------
[1xMxNxL single] [1xMxN categorical]
...
I want to reduce the first dimension of each table element like
Var1 Var2
--------------------- -------------------------
[MxNxL single] [MxN categorical]
...
How to get the table?
댓글 수: 0
답변 (2개)
Image Analyst
2019년 2월 17일
Not sure - I'd have to try some things with either table(), permute, or squeeze(). Look up squeeze and permute() in the help and experiment with some things. You might have to permute the K dimension to the end (last dimension). How many rows are there in the table?
Peter Perkins
2019년 2월 17일
You have created an Kx2 table, one of whose variables is KxMxNxL, the other is KxMxN. I don't know if that's what you intended, or if it's useful, or if you are lokking for something else. When you see things like [1xMxNxL siingle] (which obviously is not the actual output, it would help to see what you really get), it's just a display artifact. Var1 is stored in the table as a KxMxNxL array.
If you literally want an MxNxL array and a MxN array in each row of the table, you will need to split those numeric arrays into two Kx1 cell arrays, the first of which has an MxNxL array in each cell, the other an MxN array.
But it's not clear what you actually want.
댓글 수: 2
Peter Perkins
2019년 2월 18일
If this
"A : K x M x N x L array
B : K x M x N array
If I do table(A,B)"
is true, then no, they are not. They are KxMxNxL and KxMxN, even inside the table.
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!