LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone used the NAG libraries with LabVIEW?

I try to get the "g08cgc" (chi-square calculation) running, but LabVIEW hangs up everytime I start the VI..

 

Some tipps ... ?

0 Kudos
Message 1 of 8
(2,874 Views)
Most likely it's an issue with the way you're calling the DLL. Can you post your code? Without more information it will be difficult to help.
Message 2 of 8
(2,851 Views)

Hi,

 

I'll post the code when I'm back in the office (probably next week), OK?!

0 Kudos
Message 3 of 8
(2,803 Views)

Here is the code (wirtten with LV7.1)

 

Let me say that I'm a newbie using statistical functions and calculations.....

For the calculation of Chi-square I have the followind input variables:

 

- measured values

- calculated values

- coefficients

 

If you/someone can give me some tips how to calculate chi-square with this input variables it would be very helpfull (e.g. maybe MS-Excel can do this,too ?! Using .NET etc?)

 

Thanks in advance!

Message Edited by _avr_ on 01-19-2009 01:43 AM
0 Kudos
Message 4 of 8
(2,764 Views)

I'm not a statistics expert either, so I don't know if you have to use this as opposed to the built-in statistical functions that LabVIEW has. Have you looked at those?

 

As far as your call is concerned there are a few points:

 

  • Calling Convention: You have this set to "stdcall (WINAPI)". This most likely needs to be set to "C". 
  • You have specified a return value for the function, but the function has no return value. The function returns a void, not a double. The chi value is returned as one of the parameters which is passed by reference (pointer to the value).
  • I do not know if the sizes of the arrays you are sending in are adequate for the function to work properly. As I indicated, I'm not a statistics expert, so you will need to delve into the documentation for the library to determine this. 
  • I do not have the library, so I cannot verify what the datatype "Nag_Distributions" is supposed to be. You have specified it as a string. However, based on this example program for that function, it seems to be an enum, not a string. 
  • You stopped providing parameters after the "prob" parameter.
Message 5 of 8
(2,741 Views)

Hi,

 

well, the built-in statistic functions don't have a chi-square goodness of fit test............

 

The Calling Conventions must be "WinAPI) stdcall" as described by NAG.

I've corrected the size of input arrays and input parameters as you said, but still I have problem.

I think it is the "dist" input, which is defined as "enum" datatype in the C code.

 

I don't know how it must be defined in LabVIEW!?

 

I'll attache the "corrected" but unworking code again, maybe you have an idea...!

 

Thank you!

 

 

0 Kudos
Message 6 of 8
(2,717 Views)
OK, if the docs say stdcall, then stdcall it is. The new VI is closer. As far as the enum values are concerned, you have to look at the documentation as to what the actual enum values are supposed to be. If it's not in the documentation, then it will be in the header files. The example program I pointed out before uses several header files. The definition of Nag_Distributions will be in there. Also, the parameter "fail" is not a string. It's of datatype NagError. From the example program it's clear it's not a string, but a structure. The exact definition of this structure will be defined in the header files.
0 Kudos
Message 7 of 8
(2,705 Views)

I find the fail parameter easier to handle with the NAG Fortran libraries. I've written an example of using the NAG Fortran routines to perform chi-squared tests here

 

Conway

0 Kudos
Message 8 of 8
(2,240 Views)