## Spatial Modeler Discussions

Gain, exchange, and share knowledge, or discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of Hexagon Geospatial products.
Showing results for
Do you mean
Highlighted
New Contributor
Posts: 4
Registered: ‎10-17-2019

# Change table/matrix datatype to combine in matrix

Dear all!

I'm currently working on a spatial model where I want to extract certain columns of an attribute table and combine them to a text file output with column names and the according values.

Until now I was able to create two matrices: One with the actual values of according columns (integer) and one with the column names (string). I was creating tables seperately and combining them to a matrix with the Resize Matrix operator.

Matrix 1 holding attribute values (integer):

Matrix 2 holding the column names (string):

Question 1:

Is it possible to convert the table/matrix data type from integer to string to combine the two matrices with the Resize Matrix operator?

Question 2:

When writing the two matrices into a report, is it possible to only write the acutal values into the report without matrix size and data type (see screenshot below)?

I'm thankful for any hint

All the best!

Roman

Highlighted
Technical Evangelist
Posts: 1,005
Registered: ‎10-01-2015

## Re: Change table/matrix datatype to combine in matrix

Hi Roman,

Not sure about your other questions, but here's how you would convert a Table of numbers (Float, Integer, Binary) into a Table of Strings. I also put operators on to convert that Table to a Matrix (BTW - I never knew that you could have Strings in a Matrix - that's new to me) and write out a Report file:

Here's what happens inside the Iterator:

So, in my simple example I input a Float Table containing three values: 0.0, 2.0 and 5.5. That table can be used to drive an Iterator that operators on each of the three values.

In the Iterator each input Scalar value is converted to IMAGINE.Double in order to remove any "decoration". If the original Table had been integers you would use IMAGINE.Int, etc., instead. The undecorated value is then converted to String and exits the Iterator.

The Iterator thereby builds a List of three Strings. That list could be used directly as a Table of Strings, or here it's fed to a Table to Matrix operator to convert into a Matrix of Strings.

I don't think you could directly do this to a Matrix input. But you could wrap another iterator layer around this and break the Matrix into a List of Tables to be iterated over.

Hope this points you in the right direction.

Cheers

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
New Contributor
Posts: 4
Registered: ‎10-17-2019

Hi Ian!