extracting data from some specified x and y

44 views
Skip to first unread message

Kuo-Hsien Chang

unread,
Oct 2, 2013, 7:41:00 PM10/2/13
to ncto...@googlegroups.com, Brian Schlining, Alexander Crosby
Dear all,

I tried to extract data from a 4-d nc file, float npp(time=200, pft=15, latitude=289, longitude=570).
The specified x and y are given in am_7(:,2) and am_7(:,1), respectively.

>> am_7(:,2)

ans =

   126
   120
    85
    91
    83
    90
   105
   110
   135
    96
    83
   122
   124
   118
   103
   118
   106
   113
   118
   119
   110
   108
   117
    86
   120
   123
   104
    89
   121
   128
    99
   114
   115
    96
   119
   120
    93
   130
   136
   132
    79
   121

>> am_7(:,1)

ans =

   517
   473
   495
   481
   495
   446
   477
   502
   473
   475
   444
   452
   515
   450
   482
   456
   505
   450
   479
   481
   470
   467
   464
   442
   450
   451
   475
   488
   502
   460
   478
   461
   493
   447
   479
   474
   490
   513
   463
   462
   439
   475

In Matlab, I tried this, but it shows errors.
>> npp_pft1_am_7 =  (CGCM31_A2_npp_obj.data(:,1,am_7(:,2),am_7(:,1))); 
Error using indexing (line 32)
Indexing strides must be positive and constant.

What does that mean?
How to extract data for some desired grid cells?



Thanks for your helps.

Michael




Reply all
Reply to author
Forward
0 new messages