replace values with nans
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Leela Sai Krishna
el 18 de Mzo. de 2019
Comentada: Leela Sai Krishna
el 18 de Mzo. de 2019
I have a matrix data. i applied a condition and i get the idx. i want to replace that idx values with Nans.
plz suggest the process for this.
Thanks....
0 comentarios
Respuesta aceptada
Más respuestas (1)
Jos (10584)
el 18 de Mzo. de 2019
Take a look at logical indexing or the function ind2sub
M = randi(10,8,6)
% use indices of elements for which condition is true
idx = find(M > 8)
M(sub2ind(size(M), idx)) = NaN
% use logical indexing (easier in many cases)
M(M < 3) = 999
0 comentarios
Ver también
Categorías
Más información sobre NaNs 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!