how to fix "index exceed matrix dimension"?

8 ビュー (過去 30 日間)
Jesseril Suriawinata
Jesseril Suriawinata 2017 年 6 月 7 日
編集済み: Jesseril Suriawinata 2017 年 6 月 7 日
if sum(ismember(totalcheck,[ones(size(totalcheck,2))*2],'rows')) > 0
totalsection_matrix{j}{end+1} = [section_index{end}];
if ~isempty(runbet{j,1})
runbet{j,1}(end+1) = 0;
else
runbet{j,1}(1) = 0;
end
end
  1 件のコメント
KSSV
KSSV 2017 年 6 月 7 日
You have not give the complete code...how you think that we can help you?

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2017 年 6 月 7 日
編集済み: KSSV 2017 年 6 月 7 日
I assume, that you are running a loop for j, it is beyond the length of your cell array _ runbet_, so error popped out. You have to proceed like this:
for j = 1:length(runbet)
if ~isempty(runbet{j,1})
runbet{j,1}(end+1) = 0;
end
end

カテゴリ

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