Home Image-Pro Plus Automation with Macros
Options

Export an array to excel range in image pro 4.5

Hi:
We are using a legacy version of image pro - 4.5.1.
We are desiring to export an array of data obtained from a line profile into an excel sheet as a range - all in one fell swoop.  Our current method does this but one cell at a time.  This is time consuming and resource consuming.  We run out of memory very quickly.  Is there a way to export an array obtained in image pro to a range in excel all at one time and without stalling due to overwhelming computer resources?
Tagged:

Best Answer

  • Answer ✓
    You can just activate macro recording and change the fields you want to see the names of the properties.
    Here is my test macro where I changes Sheet names ("topic") and exported data to 2 sheets:

    Sub TestExcel()
    ret = IpDde(DDE_SET, "topic", "[Book1]Sheet2")
    ret = IpDde(DDE_SET, "target", "C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE")
    ret = IpProfSave("", S_DDE+S_DATA+S_X_AXIS)
    ret = IpDde(DDE_SET, "topic", "[Book1]Sheet3")
    ret = IpDde(DDE_SET, "target", "C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE")
    ret = IpProfSave("", S_DDE+S_DATA+S_X_AXIS)
    End Sub


    Yuri

Answers

  • obie,

    Why don't you use Export Data function, which exports everything to Excel in one go:

    Yuri
  • Thank you Yuri:
    Did not think to try this.  Will give it a try.  One thing is that we are attempting to put the data in specific spots (columns) in a specific order.  We are attempting to do this for a great number of images in series, and the data needs to placed in such a way that it can be organized for further analysis.
  • Actually, we did try this - it was so long ago, that I forgot.  The problem is that in table form, we only seem to be able export intensity values (Y).  We need the distance (X) values as well.
  • You can activate "X-Axis", so you get Distance values as well.


    Yuri
  • If you want to export multiple datasets quickly and in the right order, just set Increment position for the next data set to the right shift:



    Yuri
  • I thank you Yuri for what you have told me.  It has been very helpful and we are able to do this.  Is it possible to change the "active sheet" to a variable in IP basic code?  We are needing to send selected (specific) line profile data to a specific tab in the workbook, cycling through tabs systematically as different line profiles are drawn.  It is that portion of the code that we are specifically struggling with.  Apparently the function that allows us to send the contents of the array, one cell at a time is different from the function when using this DDE/Export?  Anyway, we are having difficulty getting it to work.  Is there a specific variable type that would make this work?
  • Thank you Yuri.
    This helped us get to where we need to go.
Sign In or Register to comment.