MATLAB: Find the index of nonempty array in a structure for a particular field

MATLABstructures

Hi I have a structure with one field e.g. select(i).c, where i=1,…,N. I want to find the index i for which select(i).c is nonempty. How can I do it ? Thanks

Best Answer

find(~cellfun(@isempty,{select.c}))