How to make specific elements of a cell equal to zero?
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a cell 41 * 41 dimension and I would like to make the values that over 0.5 zeros and the rest of the values keep them without any changes.
Any assistance, please?
댓글 수: 0
채택된 답변
추가 답변 (1개)
Walter Roberson
2022년 9월 15일
newCell = cellfun(@(M) M.*(M<=0.5), YourCell, 'uniform', 0)
However this will fail in locations that contain infinite values.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!