Change table variable dimension
5 次查看(过去 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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!