Print column value for lowest element in each row of an 2D array
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Koule Pantazopoulos
el 30 de Ag. de 2018
Comentada: Koule Pantazopoulos
el 31 de Ag. de 2018
I have a 2D array 20 X 10 double. Each row has a lowest figure. I am trying to obtain the column index of the minimum element in each row. I do not need the row index, just the column index. An elegant solution was provided ([~,idc] = min(A,[],2). It is able to be displayed. However, I am now having difficulty using fprintf to print the solution.Assistance appreciated
Respuesta aceptada
Greg
el 31 de Ag. de 2018
Why do you want to fprintf the result? Anyway, try:
fprintf('%d\n',idc);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!