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

2 次查看(过去 30 天)
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.

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by