Copy one variable in a struct with cuda

i have this two structs in my code

typedef struct femsample
    int clas;
    int number_of_features;
    double dist;
    double weigth;
    double value;
    double *features;
    double *probability;
    int label;
    double additional_parameters[MAX_ADDITIONAL_PARAMETERS];
}  FEMSample;

typedef struct femdataset
    int number_of_classes;
    int number_of_samples;
    int number_of_features;
    int *samples_per_class;
    FEMSample *samples;
}  FEMDataset;

And this structure is allocated in the memory of the device. I want only the dist value that is in FEMSample struct. The kernel functiob with tag global cannot return a value, only void, so, i tried to use memcpy to get this value and pass to my host code, like that:

__global__ void getDist(FEMDataset *dataset, int i, double *dist)
    memcpy(dist, &(dataset->samples[i]).dist, sizeof(double));

In my host code i have a double *array; and to get all value of dist in my struct, i call the kernel like that:

for(i = 0; i < number_of_samples; i++)
    if(samples[i].class == class)
      getDist <<<1,1>>> (d_dataset, i, &array[count]);

The d_dataset is a FEMDataset allocated in device memory, and the samples is the array of FEMSample in my host code. I can't copy the value. What did I wrong?

P.S: I tried this too but show a exception of read memory, because the d_dataset cannot be read in host code. cudaMemcpy(&array[count], & (d_dataset->samples[i]).dist, sizeof(double), cudaMemcpyDeviceToHost);