I'm using a struct to hold data on a large sample of patients. Each field corresponds to an attribute or property of the patients. There are some patients whom I wish to remove from the dataset (from the struct). How can I do this?
For example, suppose I wish to remove the i-th patient from the struct. This means I need to delete the i-th values from each field of the struct. I don't know how to do that.
Here is how I'm creating my struct (from a 135737×11 matrix "M"):
patients = struct( 'id', M(:,11), ... 'PSAtests', M(:,1), ... 'PSAestimate', M(:,3), ... 'PSA', M(:,10), ... 'isActual', 1-M(:,4), ... 'age', M(:,5), ... 'cancer', M(:,6), ... 'cancerAge', M(:,7), ... 'biopsy', M(:,8), ... 'biopsyAge', M(:,9) );
Ideally, if I wished to remove all patients over the age of 80, I could do so by something like the following:
patients(patients.age>80) = []
Any ideas? Or if I'm going about this the wrong way, please suggest an alternative data handling strategy. I welcome any comments.
Best Answer