remove rows with certain element in cell arrays
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
In the following data set, I want to keep only the rows with 'Hourly' element, thus only row 2. I use the following, but it doesn't work. Can anybody help me?
data={'s' 'e' 'daily'; 't' 'c' 'hourly'; 'm' 'b' 'daily'}
data_2 = cellfun(@(x) x(x(:,3)=='Hourly'), data, 'UniformOutput', false)
0 comentarios
Respuesta aceptada
Más respuestas (1)
Jan
el 2 de Feb. de 2012
data = {'s' 'e' 'daily'; ...
't' 'c' 'hourly'; ...
'm' 'b' 'daily'};
data2 = data(strcmpi(data(:, 3), 'hourly'), :);
Ver también
Categorías
Más información sobre Cell Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!