Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can i see the element of the a cell element of 8*8*8?
조회 수: 3 (최근 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!