Insert certain percentages of missing values in a dataset

1 view (last 30 days)
I have a dataset with a certain dimension. For example 600x10. I want to insert missing values randomly in the dataset in certain percentages such as 10% or 20%.
Can anyone help please? Thank you.

Accepted Answer

KSSV
KSSV on 25 Feb 2021
Edited: KSSV on 25 Feb 2021
A = rand(600,10) ; % demo data
N = numel(A) ; % number of elements
idx = randperm(N,10/100*N) ; % get 10% of data indices randomly
A(idx) = NaN ; % replace the indices with NaN, these are missing

More Answers (0)

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!