Index exceeds matrix dimensions.

1 回表示 (過去 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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by