X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 01 Mar 2009 05:47 AM by  anon
problem in ENVI_OPEN_FILE
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
01 Mar 2009 05:47 AM
    Hello, I encounter a problem in IDL programing. I use ENVI_OPEN_FILE, inputfilename, r_fid = t_fid and I "help t_fid"  T_FID LONG = Array[3] and I "print t_fid" 32 12 2 if (t_fid eq -1) then begin IDL tell me expression mus be a scalar or 1 element arra in this context:   below is from the HELP ENVI_OPEN_FILE  fname = '/data/img_001'  envi_open_file, fname, r_fid=fid    if (fid eq -1) then return  envi_file_query, fid, dims=dims, nb=nb   why this happened , what should I do?

    Deleted User



    New Member


    Posts:
    New Member


    --
    01 Mar 2009 08:01 PM
    I run my code in ENVI 4.3 and the problem, so I check my code carefully, and I can not find any mistakes, Then I try it in ENVI 4.5 ,there is no problem. I do not know why this happened.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    02 Mar 2009 02:00 PM
    I would think both versions of ENVI would give you an error message, as they did for me.  This is because you are opening a file that contains multiple files and thus multiple FIDs.  So your returned FID from opening the file is an array.  However, in your IF statement, you reference FID as a scalar.  Instead, you would do something like: ENVI> if(fid[0] eq -1) then return Which will test if the first element of the FID array is -1, or whichever element you want.  You should only need to test one element to see if it is valid.
    You are not authorized to post a reply.