First, in your example, you don't need the find. A logical array would work just as well:
index = enabling_conditions == 0;
If I understood correctly, you want to find the start and end of each run of 1 (or is it 0?) in your enabling_conditions, and split the signals arrays into each run:
transitions = diff([0 enabling_conditions 0]);
startruns = find(transitions == 1);
endruns = find(transitions == -1);
subsignals_1 = arrayfun(@(s, e) signal_1_gradient_filt(s:e), startruns, endruns, 'UniformOutput', false)
subsignals_2 = arrayfun(@(s, e) signal_2_gradient_filt(s:e), startruns, endruns, 'UniformOutput', false)
Note that I put the vectors into a cell array rather than a structure. I think it makes more sense. You can convert the cell array into a structure with cell2struct but naming the fields is going to be an issue.
Best Answer