I'm trying to select a value from one column in a cell array based on another value.

1 次查看(过去 30 天)
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!

采纳的回答

OCDER
OCDER 2018-10-16
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 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by