This is my test for an example for Dave..
Dear Brian (and Dave for an example),
It really worked with a minor bug fixing! Really simple and powerful
function that I didn't know.
I tried printing first and got the variable names concatenated by
comma that I wanted to produce.
IDL> print,strJoin(sst,',',/Single)
sst_cccma_cgcm3_1,sst_cnrm_cm3,sst_csiro_mk3_0,sst_gfdl_cm2_ 0,sst_gfdl_cm2_1,sst_iap_fgoals1_0_g,sst_inmcm3_0,sst_ipsl_c m4,sst_miroc3_2_medres,sst_mpi_echam5,sst_mri_cgcm2_3_2a,sst _ncar_ccsm3_0,sst_ncar_pcm1,sst_ukmo_hadcm3,sst_ukmo_hadgem1
Then, I tried first without 'EXECUTE' function because Brian's
suggestion doesn't look require it.
IDL> SAVE, FILENAME='sst_cmip3_20c3m.sav', strJoin(sst,',',/Single)
% SAVE: Expression must be named variable in this context: <STRING
('sst_cccma_cgcm3_1,ss...')>.
It didn't work! So I tried with 'EXECUTE' function following Brian's
suggestion, but got the same error message.
IDL> result=EXECUTE("SAVE, FILENAME='sst_cmip3_20c3m.sav',
strJoin(sst,',',/Single)")
% SAVE: Expression must be named variable in this context: <STRING
('sst_cccma_cgcm3_1,ss...')>.
Then, I thought that strJoin(sst,',',/Single) part should be outside
of quotation marks according to the error message.
Tried the following and got exactly what I wanted!
IDL> result=EXECUTE("SAVE,
FILENAME='sst_cmip3_20c3m.sav',"+strJoin(sst,',',/Single))
Thank you very much for your help, Brian!
Cheers,
John
|