Info

此问题已关闭。 请重新打开它进行编辑或回答。

get indices where the value is 0

1 次查看(过去 30 天)
Shathesh Kumar
Shathesh Kumar 2020-6-29
关闭: MATLAB Answer Bot 2021-8-20
Hi,
I need a fucntion that return all the indices where the value is 0. I can use a for loop for finding the indices but is there any easier way like predefined function or something

回答(1 个)

KSSV
KSSV 2020-6-29
编辑:KSSV 2020-6-29
Let A be your vector....to get indices of zero use...
idx = find(A==0) ; % gives indices directly
idx_l = A==0 ; % gives logical indices

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by