[~,i]=max(y); what does it mean in matlab

33 次查看(过去 30 天)
can i know the meaning of this command "[~,i]=max(y);" in matlab??

回答(1 个)

Mark Sherstan
Mark Sherstan 2019-2-15
编辑:Mark Sherstan 2019-2-15
Your answer can be found here, I copied and pasted it below for your convience:
The ~ represents an output that is discarded. It is essentially equivalent to:
[dummy,idx]=min(dists);
clear dummy
For this example, the code wants to work with the index of the minimum value, not the value itself, so the minimum value that is returned is discarded and only the index is retained.

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by