Dear Scilab community,
I’ve been using Scilab for several years, but now, I’m learning how to use the new timeseries / table functions to handle big amount of data.
I’m wondering how to get a new matrix or table from a previous table but with filtered “lines”.
An example would be clearer
str=["a";"b";"c";"d"]
data=[2 3; 6 6;5 4; 1 2]
t1=table(str,data,"VariableNames",["name" "var1" "var2"])
t2=t1("name")(t1("var1")>2)
t3=t1("var1")(t1("var1")>2 & t1("var2")<5)
t1 =
4x3 table
name var1 var2
____ ____ ____
a 2 3
b 6 6
c 5 4
d 1 2
t2 : Filter on “var1” Works fine to get the name column with filtered lines in a new vector
t2 =
"b"
"c"
t3 : Filter on “var1” and “var2” Works fine to get the var1 column with filtered lines in a new vector
t3 =
5.
My problem :
t4=t1(#all_table#)(t1("var1")>=2)
Result expected :
t4=
4x3 table
name var1 var2
____ ____ ____
a 2 3
b 6 6
c 5 4
How to get all columns of t1 with filtered lines ? in a matrix, string matrix or better, a new table ?
I’ve tryied t1( : ) t1( : , : ) but I probably misunderstand the table objects.
Thanks a lot for your help.
Best regards,
Laurent