[Thread Prev][Thread Next][Index]

Re: [ferret_users] generate a constant array



Hi David,
   I think the following will work:

let NYR=280
let ytemp=X[I=1:`NYR+100`:100] ! this has the right number of elements and only the last is wrong ... let years=if(i[g=ytemp] lt ytemp[i=@ngd])then ytemp else `NYR+1` ! ... so fix the last value.

If NYR=280 this gives 1,101,201,281 as desired but check the following

NYR=300 ---> 1,101,201,301
NYR=301 ---> 1,101,201,301,302

to see if that is what you need.
Mick
--------
David Wang wrote:
Hi Ferreters,

I'd like to generate a evenly-spaced constant array except the last element. For example,

{1, 101, 201, 281}

I tried:

yes? LET NYR = 280
yes? LET YEARS = X[I=1:`NYR`:100]

But this only gives {1, 101, 201}. How can I pad the element of 281? In my working code NYR is returned from another expression (not explicitly specified as above).

Thanks very much,
David



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement