I'm trying to select a value from one column in a cell array based on another value.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
benjamin powers
el 16 de Oct. de 2018
Respondida: OCDER
el 16 de Oct. de 2018
I imported an excel table in to matlab as a cell array and want. I have two columns three columns of interest; System ID, Sampling Frequency, and DOH Priority. I want to identify and System ID's that have a DOH priority of 'ND'. From here I want to make another cell array or table with all the System ID's and Sampling frequencies. I've had some success using strfind but it's just giving me my original table with 1's and 0's for the sites. Am I approaching this the right way or is there a better way to do this? Thanks!
0 comentarios
Respuesta aceptada
OCDER
el 16 de Oct. de 2018
Table = {1 23 'ND';
2 33 'ND';
3 14 'AA';
4 11 'AA';
6 16 'ND'}; %Your table, SystemID (col-1), Frequency (col-2), DOH (col-3);
NDLoc = strcmpi(Table(:, 3), 'ND'); %Logical index of ND columns
NDTable = Table(NDLoc, 1:2); %SystemID and Frequency of ND priority only
0 comentarios
Más respuestas (0)
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!