Extract from a table based on a non numerical input

2 visualizzazioni (ultimi 30 giorni)
Hi,
I am simply trying to create a table for each of the machine IDs.
I want to extract all rows in the collumn that have the same machine ID. If it was numerical I would simply use some logic but I am unable to and the ('==') function does not work
I want to extract the rows based on collumn one (SAPID). A screenshot of the table can be seen below. The inputs in collumn one are of the form similiar to XXX01X01.

Risposta accettata

Cris LaPierre
Cris LaPierre il 15 Lug 2021
What is the error message you are getting? Please share the full error message (all red text).
If your syntax is correct, it should work. See how to access data in a table page here.
% Set up table
SAPID = ["WDS01A04";"WDS01A04";"WDS01A05"];
TimeStamps = datetime(2019,01,01)+hours(0:2)';
ActPower_Value_mean = [3608;3608;3608];
NacelTmp_Value_mean = [32;32;32];
ConvTmp2_Value_mean = [45.0229;45.1712;45.2676];
dataT = table(SAPID,TimeStamps,ActPower_Value_mean,NacelTmp_Value_mean,ConvTmp2_Value_mean)
dataT = 3×5 table
SAPID TimeStamps ActPower_Value_mean NacelTmp_Value_mean ConvTmp2_Value_mean __________ ____________________ ___________________ ___________________ ___________________ "WDS01A04" 01-Jan-2019 00:00:00 3608 32 45.023 "WDS01A04" 01-Jan-2019 01:00:00 3608 32 45.171 "WDS01A05" 01-Jan-2019 02:00:00 3608 32 45.268
% Extract just rows with SAPID of "WDS01A04"
mchn1 = dataT(dataT.SAPID=="WDS01A04",:)
mchn1 = 2×5 table
SAPID TimeStamps ActPower_Value_mean NacelTmp_Value_mean ConvTmp2_Value_mean __________ ____________________ ___________________ ___________________ ___________________ "WDS01A04" 01-Jan-2019 00:00:00 3608 32 45.023 "WDS01A04" 01-Jan-2019 01:00:00 3608 32 45.171

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by