Link to home
Start Free TrialLog in
Avatar of almaha
almahaFlag for Saudi Arabia

asked on

Origin Code Builder

What's wrong with this code:
--------------------------------------------------------------------------------------------------------------------
//      Program to calculate the skewness and kurtosis of BMD for
//      each level of AGE within an Origin WORKSHEET, and
//      to place these results back inside the same worksheet.
//      The statistics are calculated using a NAG routine.

void  DSXXX()
{
      double xsd,xskew, xkurt, wsum, xmean, xmax, xmin;
      double * wt;
      int success, i, weight, nvalid = 10;
      wt = NULL;
      Dataset xx("Data1",2);
      //Dataset cannot be used as a parameter, but vector can.
      vector x = xx;
      
      success = nag_summary_stats_1var(nvalid, x, wt, &nvalid, &xmean, &xsd, &xskew,
            &xkurt, &xmin, &xmax, &wsum);

         printf("Number of cases is %d\n", nvalid);
         printf("And there is no weight\n");
         printf("The input is following : x=\n");
         
         for(i=0; i<10; i++)
      {
            printf("%10.1f", x[i]);
            if((i+1)%10 == 0)
            printf("\n");
      }
      
      printf("\nsuccess is%d\n", success);
      if(success == 0)
      {
            printf("\nsucessfully call of the nag_summary_stats_1var function\n");
            printf("the output is following:\n");
            printf("No of valid cases         %10d\n", nvalid);
            printf("mean                      %10.1f\n", xmean);
            printf("std devn                  %10.1f\n", xsd);
            printf("Skewness                  %10.1f\n", xskew);
            printf("Kurtosis                  %10.1f\n", xkurt);
            printf("Minimun                   %10.1f\n", xmin);
            printf("Maximum                   %10.1f\n", xmax);
            printf("Sum of weights            %10.1f\n", wsum);
      }
      else
      {
            printf(" \n There are some problems.");
      }      

}
ASKER CERTIFIED SOLUTION
Avatar of van_dy
van_dy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of almaha

ASKER

its ok.
i solved the problem.

but i'm facing lots of barriers. i would like to get some help in this section. OriginLab, originPro 7.5 Scripting << which is in C Language.

if anyone have been programming in this area please let me know.

thanks alot