table(matrix_obj)

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

table(matrix_obj)

Message par compsystems » sam. mars 23, 2019 2:41 am

Hello,
What is the procedure to create a table, from a matrix, where the first column vector is the positioning value

strList = ["one", "two", "three"]
numberList = [1, 2, 3]
array_strNum = zip( strList, numberList ) [enter] returns

[["one",1],
["two",2],
["three",3]]

table1 = table(array_strNum) [enter] returns

table(
(0,0)="one",
(0,1)=1,
(1,0)="two",
(1,1=2)... # ok, but


table2=table("one"=1,"two"=2,"three"=3) # this is what is desired

to then obtain the original matrix

unzip(table2) >

[["one",1],
["two",2],
["three",3]]

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: table(matrix_obj)

Message par parisse » sam. mars 23, 2019 9:36 am

Sorry, I don't understand what kind of conversion you want to do.

Répondre