Index exceeds matrix dimensions.

2 Ansichten (letzte 30 Tage)
Parthiban Aravamudhan
Parthiban Aravamudhan am 10 Mär. 2021
Bearbeitet: Jan am 10 Mär. 2021
check_data=test_data_in(1:600);
for i=1:600
check_data(i)=test_data_in(randi(numel(test_data_in)))
end

Antworten (1)

Jan
Jan am 10 Mär. 2021
Bearbeitet: Jan am 10 Mär. 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?

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by