Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

get indices where the value is 0

2 vues (au cours des 30 derniers jours)
Shathesh Kumar
Shathesh Kumar le 29 Juin 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
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

Réponses (1)

KSSV
KSSV le 29 Juin 2020
Modifié(e) : KSSV le 29 Juin 2020
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

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by