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

조회 수: 2 (최근 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에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by