Effacer les filtres
Effacer les filtres

Index nearest vlaue to zero between some negative and posetive values in one row

2 vues (au cours des 30 derniers jours)
Hello, I have a table, I want to index the nearest value to the zero in each row; I have some data like -0.009, 0.0025 ( I mean negative and positive).
If I want to index nearest rows to 1 I know I can use this:
[~,i] = min(1-[TEST.model1_CC, TEST.model2_CC, TEST.model3_CC],[],2);
But I have'nt Idea how to index nearest value to the zero.

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Avr 2020
[~,i] = min(abs([TEST.model1_CC, TEST.model2_CC, TEST.model3_CC]),[],2);

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by