how to find maximum value from a matrix then add a value to it and then replace that in the same matrix?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
suchismita
el 13 de Jun. de 2014
Comentada: suchismita
el 20 de Jun. de 2014
I have a matrix a=rand(4,10), 1)i want to find the maximum or the highest value in matrix a. 2)add 0.001 to that highest value 3)replace the existing highest value with this added new value without changing any other value
can it be done????
please help me... i am too bad in matlab.
0 comentarios
Respuesta aceptada
W. Owen Brimijoin
el 13 de Jun. de 2014
This ought to do the job!
a=rand(4,10);
a(a==max(a(:))) = a(a==max(a(:)))+0.001;
3 comentarios
W. Owen Brimijoin
el 13 de Jun. de 2014
Sure thing! Mind you, if there is more than one entry in your array that each happen to be equal to the maximum value, then that code will add 0.001 to both of them. Be warned!
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!