Azzera filtri
Azzera filtri

How can i extract data from given variables, for suppose i want to extract charge and discharge separately.

1 visualizzazione (ultimi 30 giorni)

Risposte (1)

Matt J
Matt J il 6 Dic 2023
Modificato: Matt J il 6 Dic 2023
I will assume your data is in a table:
type=["charge";"discharge";"discharge";"charge"];
data=(1:4)';
T=table(type,data)
T = 4×2 table
type data ___________ ____ "charge" 1 "discharge" 2 "discharge" 3 "charge" 4
Tcharge=T(T.type=="charge",:)
Tcharge = 2×2 table
type data ________ ____ "charge" 1 "charge" 4
Tdischarge=T(T.type=="discharge",:)
Tdischarge = 2×2 table
type data ___________ ____ "discharge" 2 "discharge" 3

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by