Hello,

I have implement a data structure that stores two columns of experimental data using the gsl_vector type. However, I am having a run time error when initialising the my custom data type, EXC_BAD_ACCESS. I think it is silly pointer related problem.

Can anybody help? I have highlighted the line in the following code.

Regards,

Dan.

___

typedef struct _Spectra
{

  gsl_vector *x;
  gsl_vector *y;
  unsigned count;

} Spectra;

void MakeSpectra (Spectra *spectra, double *x, double *y, unsigned count)
{
                
  /* error on the line below */
  spectra->x = gsl_vector_alloc(count);

  spectra->y = gsl_vector_alloc(count);
  memcpy(spectra->x->block->data,x,count * sizeof(double));
  memcpy(spectra->y->block->data,y,count * sizeof(double));
  spectra->count = count;

}




_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to