how can i replace the n lowest elements(ascending order) of a cell by some defined function
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
studentambitious
el 16 de Nov. de 2015
Respondida: Walter Roberson
el 16 de Nov. de 2015
I have a cell of 256x256. I want to replace the n lowest values of a cell by some defined function. the element position shall remain the same... please help
0 comentarios
Respuesta aceptada
Walter Roberson
el 16 de Nov. de 2015
In order to be able to replace the n lowest values of the cell, you need to be able to "order" the cell elements ("order" is the underlying mathematical principle of "sorting"). In general that cannot be done, just like you cannot uniquely sort complex numbers.
The ability to sort cells is defined in MATLAB only for cell arrays of strings.
If the cells happen to contain scalar (non-complex) numeric values then you can convert the cell to a numeric array and sort that to find the lowest values.
For anything else, you need to define a function that is able to take two of your cell inputs and output the relationship between them, whether the first is "less than" the second or not. Being able to test "equal to" also helps.
If you have such a function then you can begin your task of replacing the 15 "lowest" values.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Cell Arrays 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!