X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Jul 2008 04:10 PM by  anon
Regarding writing the data (results) into ascii or excel file
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 Jul 2008 04:10 PM
    Hi, I have created an idl routine which takes multiple images using dialog_pickfile.Using a loop i am exporting n images.I am calculating the percent of soil and water and its displaying in the console window.I want to write that into an ascii file or excel.Any help would be appreciated.I tried but only the last image result is stored ignoring the rest.Thanks in advance.

    Deleted User



    New Member


    Posts:
    New Member


    --
    16 Mar 2009 01:01 PM
    Yes. currently, IDL does not have any capability to read and write excel files. This is a serious weakness. I do not know if or not the software developers are aware of this.   

    Deleted User



    New Member


    Posts:
    New Member


    --
    16 Mar 2009 05:25 PM
    You can write to an ascii file fairly easily using the printf procedure.  For Excel documents, go to the code contribution library on this site, there are two excel reading utilities that may help.  To write to Excel, I would write to a .csv file, which Excel can read. To do a .csv (an ascii file with comma delimiters) you can do something like this: pro make_csv     x = randomu(seed, 10,100, /double)     openw, lun, 'test.csv', /get_lun, width=10000         sizex = size(x, /dimensions)     stringx = strtrim(x,2)     stringx[0:sizex[0]-2, *] = stringx[0:sizex[0]-2, *] + ','         printf, lun, stringx     close, lun, /file     free_lun, lun end

    Deleted User



    New Member


    Posts:
    New Member


    --
    17 Mar 2009 02:23 PM
    Well, if you are using Windows and you have IDL 6.3+ and a copy of Excel on your computer, you can in fact read/write excel files using ActiveX/COM controls.  Search the code contribution site for Excel and you should find some code to help you do that.  Last time i looked they had a nice little read_excel routine packaged up for you, but if you look a little further into the code they give you, you can find routines for writing excel files and for calling the activex routines to do it all yourself.   But as for your output, it sounds like you have some issues with your output file loop.  are you opening/closing the same output file for each image? if so, make sure you're opening the output file for appending, not writing, or you're only gonna see output for the last image.  If that's not the problem, something else is wrong with your loop somewhere.   Jeff
    You are not authorized to post a reply.