Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)

Réponses (1)

Matt J
Matt J le 6 Déc 2023
Modifié(e) : Matt J le 6 Déc 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

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by