matlab - Set specific elements on a matrix to zero -
i want preserve elements in 36x18x12000 matrix , set else zero. in particular, i'm interested in getting values of specific region in 36x18 map through time. code i'm trying use following:
coflux_sam(1:26,1:3,:)=0;coflux_sam(35:36,11:18,:)=0
what plan here keep south american region (lon 27:34 ; lat 4:10 in map) , delete rest, basically. i'm getting pretty annoyed of finding neither line nor loop:
for i=1:26 j=1:3 coflux_sam(i,j,:)=0; end end i=35:36 j=11:18 coflux_sam(i,j,:)=0; end end
are working. seem make random modifications in matrix don't find pattern it.
sorry delay in putting answer here, saw had to close thread. copy , paste can closed. cheers
ok, nevermind...i being silly , getting worried code , not logic behind wanted. changed code to: 'coflux_sam(1:26,:,:)=0;coflux_sam(35:36,:,:)=0; coflux_sam(:,1:3,:)=0;coflux_sam(:,11:18,:)=0;' , works. previous 1 deleting intersection between longitude , latitude , not needed...silly me. thank anyway if bothered have look. cheers!
Comments
Post a Comment