Subscribe Bookmark RSS Feed

Data Table Column With Matrix Values

aallman

Occasional Contributor

Joined:

Feb 28, 2017

I have a table with a column that contains a matrix in every row. I am writing a script to search within the matrix of a specific row. However, the problem I am running into is that when I try to retrieve a value from that column it returns as " { [1, 2, 3, 4] } " instead of as a matrix. This means I cannot use the Loc() function that I need. I figured out that if I subscript the list with a 1 (as in :Col[row][1]) then I get rid of the list brackets but I am still left with the matrix as a string ( "[1, 2, 3, 4]" ) and I still cannot use it in matrix functions. 

 

What am I doing wrong and how can I get this to work???

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

My guess is that the column has a data type of character.

You can convert the string to a list using Parse, then take the first element as a matrix:

value = " { [1, 2, 3, 4] } ";
lst = Parse(value);
show(lst);
mat = lst[1];
show(mat);
-Dave
1 REPLY
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

My guess is that the column has a data type of character.

You can convert the string to a list using Parse, then take the first element as a matrix:

value = " { [1, 2, 3, 4] } ";
lst = Parse(value);
show(lst);
mat = lst[1];
show(mat);
-Dave