Everytime I try editing arrays of structs by field, I discover I really need to take a few weeks and try to really learn Matlab. Right now, I have an array of structs, where each struct has fields along the line of:
x.fruit, x.color, x.season, x.source, x.flibbertigibbet
each of these fields is a string. I also have an cell array of strings:
y = {'apple', 'banana', 'palm of granite'}
I would like to remove all struct where x.fruit is in y (e.g. x.fruit == 'apple'), but can't seem to find a way to do this other than by looping through y.
I was hoping for something along the lines of:
bad_idx = [x(:).fruit in y];
x(bad_idx) = [];
Is this doable? Is there someway to use cellfun to do this?