Possibility of using vectorisation here?

1 回表示 (過去 30 日間)
jnaumann
jnaumann 2015 年 1 月 13 日
コメント済み: jnaumann 2015 年 1 月 13 日
Hi there - I am currently using this bit of code but it is very slow to execute, I'm sure there is a way to speed up the process through vectorisation but can't get my head around it. Does anyone have any ideas?
for i=1:4
for j=1:365
for k=1:24
inds=(strcmp(cond1{i},cond) & doy==j & H==(k-1));
count_2011(i,j,k)=sum(inds & Y==2011);
median_2011(i,j,k)=median(dist(inds & Y==2011));
count_2013(i,j,k)=sum(inds & Y==2013);
median_2013(i,j,k)=median(dist(inds & Y==2013));
end
end
end
Many thanks in advance
  2 件のコメント
Adam
Adam 2015 年 1 月 13 日
You haven't included all the relevant code there. What are cond, cond1, H and Y, all of which appear to be constants, not changing inside the for loop.
jnaumann
jnaumann 2015 年 1 月 13 日
I guess my point is that they are logical arrays and it was the method Iwas interested in

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by