Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can i see the element of the a cell element of 8*8*8?
1 次查看(过去 30 天)
显示 更早的评论
Given A is 35*35*35 cell, each cell contains a matrix of 8*8*8 [double]. For each matrix, elements are either 1 or 0. (It means 512 elements in each matrix)
- A is [35* 35*35 cell]
- A(1) is [8*8*8 double] If i want to see a designated cell says A(159) and count the number of one for each matrix How can i see this?
- If i want to see a designated cell says A(159) and count the number of one for each matrix How can i see this?
- I tried "A(159)" gives me [8x8x8 double] but i want to see all 512 elements.
- Some background information: A big 3d matrix is cut and form cells. I want to perform 3d dct for each cell. but before that, i want to count the ones in each cells first as there are many equal cells, for example a cell with all 512 zeros. If I can find all zero cell, I can reduce the complexity of 3d dct.
Please also provide some codes, thank you
0 个评论
回答(2 个)
Image Analyst
2013-11-23
Simply have A{159} all by itself on a command line to see the values
A{159}
Then to count the number of elements of each value you can use hist() or histc(). If you have specific values in mind, use sum
numberOfOnes = sum(A{159} == 1);
numberOfZeros = sum(A{159} == 0);
% Count number of non-zeros
if nnz(A{159}) == 0
% Array is all zeros, so now can simplify.
% Your code to simplify
end
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!