フィルターのクリア

Index out of bounds

1 回表示 (過去 30 日間)
Ynne
Ynne 2016 年 7 月 19 日
回答済み: Star Strider 2016 年 7 月 20 日
Hello, I am trying to run a script and I am getting the following error: Attempted to access ym(:,2); index out of bounds because size(ym)=[50000,1]
Here is the piece of code where the error appears:
for t = 1 : T % repeat 10 times ym = [];while (length(ym)<M), ym = [ym; ggrnd(M0(i),A0,B0,M,1)]; end; Ym(:,d,i,t) = ym; s = ones(M,1); for m = 1 : PARA.zsize, s(find(ym(:,m)<a(m))) = 0; s(find(ym(:,m)>b(m))) = 0; end, Hm = s; Rt1(t) = mean(Hm); end
Can Someone help me to solve it? Thanks

回答 (1 件)

Star Strider
Star Strider 2016 年 7 月 20 日
Your vector ‘ym’ has 50000 rows and 1 column. In your code, you are addressing column 2 that does not exist.

カテゴリ

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