read an array and output at intervals

2 ビュー (過去 30 日間)
Damith
Damith 2015 年 9 月 29 日
コメント済み: Damith 2015 年 9 月 29 日
Hi,
I need to output 'out' as shown below using a MATLAB script. I want every year 106th row to read and output. Following script won't do this. Can someone help in this regard?
out=prcp(106:365:end,1:2);
out=1998106 0
1999106 13.2
2000106 0
.
2013106 0
prcp= 1998001 0
.
.
1998106 0
.
.
1999106 13.2
.
2013106 0
  2 件のコメント
Matthew Eicholtz
Matthew Eicholtz 2015 年 9 月 29 日
What is it that you want? I cannot tell from the description.
Damith
Damith 2015 年 9 月 29 日
編集済み: Damith 2015 年 9 月 29 日
I want 'out' as shown using 'prcp'. prcp is a 5502x2 matrix. Need to read every year 106th row.
e.g. 1998001 1998 is the year and 001 is the day (Jan 01) and so on.

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

採用された回答

Mohammad Abouali
Mohammad Abouali 2015 年 9 月 29 日
編集済み: Mohammad Abouali 2015 年 9 月 29 日
mask = (mod(prcp(:,1),1000) == 106);
out=prcp(mask,:)
if you want to also include "1998001 0", (apparently the first row) then
mask = (mod(prcp(:,1),1000) == 106);
mask(1)=true;
out=prcp(mask,:)
  1 件のコメント
Damith
Damith 2015 年 9 月 29 日
Thanks a lot. This is what I wanted.

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

その他の回答 (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