mardi 26 juillet 2022

Generate Random Number, that is that is repeatable

I have generated a code in order to replace the entire original column, with random repeated value but it doesnt give the desired output

enter code here
 
 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 integer numbers (e.g., 781234012)

For example, if the original column is

Original Column
 209026000   
 209026000
 209026000
 209026000
 209026000
 209026000
 

 % The expected output would be something 
 781234012
 781234012
 781234012
 781234012
 781234012
 781234012

Or if

 Original Column
 209026000   
 209026000
 209026000
 209026000
 209026000
 209026000

The Output is by replacing the last two or three digits

 209026108   
 209026108
 209026108
 209026108
 209026108
 209026108



Aucun commentaire:

Enregistrer un commentaire