how to fix "index exceed matrix dimension"?

3 次查看(过去 30 天)
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 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