How to replace multiple cells in an array with DIFFERENT random numbers
Mostrar comentarios más antiguos
I'm attempting to replace values above a certain threshold in array with different random numbers. My code currently replaces all of these values above the threshold with the same random number. I can do this really easily in Excel, but can't seem to find the right code in matlab. I know a loop is probably the best approach, but none of my attempts have worked yet.
Here's an example of my current code
muo_t2 = mean(ERDC128Bx_obliq);
stdo_t2 = std(ERDC128Bx_obliq)/(mean(ERDC92Bx_obliq) - muo_t2);
obliq_t2 = obliq;
obliq_t2( obliq_t2 > muo_t2 ) = norminv(rand(),muo_t2,stdo_t2);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!