Generate Random Number, that is that is repeatable
Mostrar comentarios más antiguos
Hi,
I have generated a code in order to replace the entire original column, with random repeated value but it doesnt give the desired output
% Code is
if range(Selected_Data1(:,1)) ==0
for Iter=1:length(Selected_Data1)
rng(1);
P_MMSI(Iter) = rand(1);
end
end
The above code always replace the value 209026000 with 0.417022004702574, nevertheless, I am expecting the random output vector would be 9 interger numbers (e.g., 781234012)
For example, if the original column is
209026000
209026000
209026000
209026000
209026000
209026000
209026000
209026000
209026000
209026000
% The expected output would be something
781234012
781234012
781234012
781234012
781234012
781234012
781234012
781234012
781234012
Respuesta aceptada
Más respuestas (1)
David Hill
el 26 de Jul. de 2022
Use randi
randi(1e9,1)
1 comentario
neamah hasan
el 26 de Jul. de 2022
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!