Index in position 1 is invalid. Array indices must be positive integers or logical values.
1 回表示 (過去 30 日間)
古いコメントを表示
ctx= 0:5
choices= 1:3
bi= 1:18
n= 0
z= 0
for i= 1:length(ctx)
trialsInContext=find(cellfun(@(x)(x.contexts== n), trialrec));
n= n+1
for j= 1:length(choices)
sum(cellfun(@(x)(x.choice== j), {trialrec{trialsInContext}}))
length(trialsInContext)
numChoicesThisBandit = sum(cellfun(@(x)(x.choice== j), {trialrec{trialsInContext}}));
numChoicesThisBandit/length(trialsInContext)
z= z+1
bar(bi, pc(ctx(i), choices(j)));
bi= bi+1;
hold on
end
end
0 件のコメント
回答 (1 件)
Kevin Phung
2019 年 2 月 22 日
this line may be the cause:
bar(bi, pc(ctx(i), choices(j)));
because for i = 1, ctx(1) = 0.
you cant index pc at the 0th value.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Common Weakness Enumeration (CWE) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!