Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)

Antworten (1)

Matt J
Matt J am 6 Dez. 2023
Bearbeitet: Matt J am 6 Dez. 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

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by