what does it mean by writing [~,idx] in code?
Mostrar comentarios más antiguos
for p= 4:4:population
dists= total_dist(rand_pair(p-3:p));
[~,idx]=min(dists);
best = routes(idx,:);
what idx, ~ means??
5 comentarios
the cyclist
el 27 de Abr. de 2013
Yogesh, I don't know why you posted this question four times, but I deleted the other three.
merlin toche
el 10 de Mzo. de 2023
Hello
anyone can help me with my code below? I want to do a classification using fuzzyknn.please, I tried to do what I can but as I'm still a beginner, I need your help to finalize this work. thank you for your advance here attached my code
Steven Lord
el 10 de Mzo. de 2023
Since this doesn't sound like it's related to the original question about the [~, idx] syntax you should ask it as a separate question using the Ask link at the top of this page.
merlin toche
el 13 de Mzo. de 2023
please I posted the question as you asked so well but no answer. I went through this page because for 2 months my concerns have been ignored, can you explain this to me? thank you
merlin toche
el 13 de Mzo. de 2023
i have this error when i plot my code
attached

Respuesta aceptada
Más respuestas (1)
the cyclist
el 27 de Abr. de 2013
Editada: the cyclist
el 27 de Abr. de 2013
When you see
>> [a,b,c] = function(...)
then a,b, and c are the output of a function. If you do not want one of the outputs of a function, then you can replace it with the ~ symbol:
>> [a,~,c] = function(...)
and then b will not be output.
1 comentario
James Tursa
el 27 de Abr. de 2013
To clarify, the syntax doesn't actually prevent the function from producing the output ... it just causes MATLAB to ignore the output and automatically clear it instead of assigning it to a workspace variable. So using the syntax makes your code cleaner looking but the function will still use the same resources (time & memory) to run.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!