how to fix "index exceed matrix dimension"?

3 Ansichten (letzte 30 Tage)
Jesseril Suriawinata
Jesseril Suriawinata am 7 Jun. 2017
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 Kommentar
KSSV
KSSV am 7 Jun. 2017
You have not give the complete code...how you think that we can help you?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 7 Jun. 2017
Bearbeitet: KSSV am 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

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by