read an array and output at intervals
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Damith
am 29 Sep. 2015
Kommentiert: Damith
am 29 Sep. 2015
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 Kommentare
Akzeptierte Antwort
Mohammad Abouali
am 29 Sep. 2015
Bearbeitet: Mohammad Abouali
am 29 Sep. 2015
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,:)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!