for loop dismension mismatch

i am trying to create a variable w < 24x1 double > so I can plot it against daily hours.
idx = find(lat< 34 & lat > 33 & lon < -117 & lon > -119);
w=zeros(24,1000);
for i = 1:24
tmp=w10(i,:,:);
w(i,:)=tmp(idx);
end
w(w==0)=NaN;
wmean=nanmean(w,2)
but matlab gives me an error message saying dimension mismatch and I can't understand why. I also tried to create a matrix w=zeros(24,207).
my w10 is < 24x207x129 double>
I am trying to pull out wind data at specific coordination (defined by idx). Is there any other way to plot hr < 24x1 > against w < 24x1 > at the specific coordinates I gave?

 採用された回答

Matt J
Matt J 2013 年 5 月 28 日
編集済み: Matt J 2013 年 5 月 28 日

0 投票

Something like this, perhaps
w=zeros(24,length(idx));
for i = 1:24
tmp=w10(i,:,:);
w(i,:)=tmp(idx);
end

1 件のコメント

Rhyn
Rhyn 2013 年 5 月 28 日
thanks a lot. it works perfectly!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

質問済み:

2013 年 5 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by