필터 지우기
필터 지우기

determine the coordinates with the 0's within a cell

조회 수: 1 (최근 30일)
Alberto Acri
Alberto Acri 2023년 7월 25일
편집: Bruno Luong 2023년 7월 25일
Hi! I have this cell. How can I determine the coordinates where the 0's are?
For example in 'matrix' I need to get a matrix with the coordinates (2,2) and (1,4):
matrix = importdata("matrix.mat");
out = [2,2; 1,4];

채택된 답변

Bruno Luong
Bruno Luong 2023년 7월 25일
편집: Bruno Luong 2023년 7월 25일
Why storing scalars in cell and not in matrix? It is very inefficient.
load matrix
check_1
check_1 = 4×2 cell array
{[1]} {[1]} {[1]} {[0]} {[1]} {[1]} {[0]} {[1]}
[i,j]=find(cellfun(@(x) isequal(x,0), check_1));
ij = [i,j]
ij = 2×2
4 1 2 2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by