Info
This question is closed. Reopen it to edit or answer.
How can i see the element of the a cell element of 8*8*8?
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
Image Analyst
on 23 Nov 2013
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 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!