Index exceeds matrix dimensions.

1 vue (au cours des 30 derniers jours)
Parthiban Aravamudhan
Parthiban Aravamudhan le 10 Mar 2021
Modifié(e) : Jan le 10 Mar 2021
check_data=test_data_in(1:600);
for i=1:600
check_data(i)=test_data_in(randi(numel(test_data_in)))
end
  1 commentaire
Jan
Jan le 10 Mar 2021
You forgot to ask a qeustion.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 10 Mar 2021
Modifié(e) : Jan le 10 Mar 2021
Your code runs without problems:
test_data_in = rand(1, 1000);
check_data = test_data_in(1:600);
for i = 1:600
check_data(i)=test_data_in(randi(numel(test_data_in)));
end
So what is your problem?
Does your test_data_in has less than 600 elements?

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by