MATLAB: Trimming arrays within cell

cell arraysindexingtrimming

I have a cell array containing many vectors (traces). I would like to use another cell array, containing the index of the first useful number in each vector, to trim the beginning of each vector.
a for-loop method would be:
for t = 1:numel(traces)
traces{t} = traces{t}(first{t}:end)
end
but this is ugly and I feel like there must be a non-for-loop based way of doing this, perhaps using cellfun?

Best Answer

The shown code is fast and clear. A reader can recognize, what it should do directly. I hestitate to think, that a corresponding cellfun command would be faster or nicer. So you do not get an advantage for debugging or the runtime. Even if the runtime is a little bit faster, the effort for programming and debugging will exceed this time.
So I'd perfer the "solution" not to care about the "ugliness" of such a useful piece of code. I've seen many code, which are much more ugly.