Fill array with NaNs
Actividad más reciente Edición por Bruno Luong
a las el 28 de Oct. de 2024
Time to time I need to filll an existing array with NaNs using logical indexing. A trick I discover is using arithmetics rather than filling. It is quite faster in some circumtances
A=rand(10000);
b=A>0.5;
tic; A(b) = NaN; toc
tic; A = A + 0./~b; toc;
If you know trick for other value filling feel free to post.
2 Comentarios
Tiempo descendente