Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)

Respuestas (1)

Matt J
Matt J el 6 de Dic. de 2023
Editada: Matt J el 6 de Dic. de 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

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by