Hexagon Geospatial
MENU

Spatial Modeler Tutorials

Learn more about our products, find answers, get the latest updates, and connect with other Hexagon Geospatial product users, or get support from our professional service team.
Showing results for 
Search instead for 
Do you mean 

Smear a Table to a Matrix (Snippet)

by Technical Evangelist ‎09-05-2018 01:35 PM - edited ‎09-12-2018 09:23 AM (317 Views)

Download model

Description:

Don't ask my why (although you'll see why in the next Spatial Recipe), but I had a requirement to take a Table with n rows in it and convert to a n x n Matrix where each column contains the values from the original Table. In other words, this...

 

Table.PNG

 

...needed to be turned into this...

 

matrix.PNG

 

 

So I reviewed these two previous Spatial Recipes...

 

Set Matrix Center Snippet

Filter an Image n Times using the Iterator Operator 2016

 

...and came up with the following Snippet that can be re-used in larger models

 

smear_table_to_matrix.gmdx
Smear_Table_Model.PNG
 
Iterator for Matrix Filenames
Iterator_Filenames.PNG
 
Iterator to populate Matrix
Iterator_Matrix.PNG

 

If you wanted to insert this into a larger model what I would suggest is to select everything apart from the input Matrix and the output Report operators (far left and far right of the model) and click Create Submodel. Select just that sub-model, right click and select Copy and then you can Paste it into other models as a re-usable "operator" 

 

Redux

 

Apparently there's a much simpler way to achieve this:

 

smear_table_to_matrix_v16_5_1.gmdx
Smear_Table_Model2.PNG

 

Download model smear_table_to_matrix_v16_5_1.gmdx

 

This approach is used in the Table to Matrix submodels of the "Report Factor Loadings (Correlation) between Principal Components and Input Bands" article:

 

https://community.hexagongeospatial.com/t5/Spatial-Recipes/Report-Factor-Loadings-Correlation-betwee...

Courses
Contributors