Why wont it output index?
Mostrar comentarios más antiguos
function[max,index]=MyMax(x)
max=0;
[n,m]=size(x);
for i=1:m
if max<x(i)
max=x(i);
index=i;
output = [max, index];
end
end
end
Respuesta aceptada
Más respuestas (1)
Sulaymon Eshkabilov
el 9 de Oct. de 2019
Editada: Sulaymon Eshkabilov
el 9 de Oct. de 2019
Just use:
[MAX_VAL, INDEX] = min(x) % instead of max()
Good luck.
1 comentario
Hunter Steele
el 9 de Oct. de 2019
Categorías
Más información sobre Matrix Indexing 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!