how to fix "index exceed matrix dimension"?

3 views (last 30 days)
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 Comment
KSSV
KSSV on 7 Jun 2017
You have not give the complete code...how you think that we can help you?

Sign in to comment.

Answers (1)

KSSV
KSSV on 7 Jun 2017
Edited: KSSV on 7 Jun 2017
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

Community Treasure Hunt

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

Start Hunting!