I don't think my problem is so exotic that there isn't already some tool available for matlab, but I don't know exactly what to search for...:
I have a series of repeated measurements, which however are very noisy and only by averaging them all together I get an idea how the actual signal looks like.
But since probably a few of these measurements are only noise, I want to exclude them from the average.
So I'd like to write a script that optimizes the average signal by randomly including/excluding all possible combinations of measurements. I have a rough idea how these criteria would look like (e.g. maximize the height of the signal peak, minimize the signal variance during baseline...) but I don't really know how to weigh them against each other.
-- you may stop and answer here, but also there is a next step:
I make these measurements at many different positions (acutally voxels in a brain image) and should then decide which voxels are to be included in the average over all voxels. Maybe I could repeat the process, again optimizing the total signal by randomly excluding various voxels.
So far, this might work with a few for loops. But an additional problem is that the signal might look very different in different voxels (maybe goes in a positive direction in some voxels and in a negative in others...). So I'm also thinking about using an ICA to detect different signals, but If I already introduce some selection at the single voxel level by including only certain measurements, it might ruin the ICA, but If I don't do it the noise might be too hight. Is there a way to inform an ICA about the data structure / repeated measurements ?