Index exceeds matrix dimensions.

조회 수: 2 (최근 30일)
Parthiban Aravamudhan
Parthiban Aravamudhan 2021년 3월 10일
편집: Jan 2021년 3월 10일
check_data=test_data_in(1:600);
for i=1:600
check_data(i)=test_data_in(randi(numel(test_data_in)))
end
  댓글 수: 1
Jan
Jan 2021년 3월 10일
You forgot to ask a qeustion.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2021년 3월 10일
편집: Jan 2021년 3월 10일
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?

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by