Who rated this article

Showing results for 
Search instead for 
Do you mean 

Set Matrix Center Snippet

by cassie.tamblyn on ‎12-09-2015 11:52 AM - edited on ‎04-14-2016 02:53 AM by Community Manager (1,302 Views)

Download model

Description:

This model demonstrates how to change the center value in a matrix. The model is a snippet and is intended to be used as part of a workflow (placed into a larger model) and, as such, does not have input/output port operators.

 

Provide the 'New Value' port of the 'Set Center Value' submodel with the desired value, enter a filename for the output matrix that will have this new center value, and you're done. The snippet will take whatever input matrix has been selected for Custom Matrix Input, will change the center value to New Value and write the resulting new matrix to Matrix File Output. The Inputs and Outputs can be removed to hook the snippet up into a larger model workflow.

 

You can see this snippet being used in a larger Model in the Article entitled "Blended Filters". There it is used to initialise another matrix that is the same size as the main matrix selected by the user, but which contains all zeros apart from the center value, which is set to one (via the New Value port shown below).

 

SetMatrixCenter-v15_1_1.gmdx
SetMatrixCenter-v15_1_1.PNG
Set Center Value submodel
SetMatrixCenter-v15_1_1-submodel.PNG
Set Matrix Element submodel
SetMatrixCenter-v15_1_1-sub-submodel.PNG

 

Input parameters:

Set Center Value.New Value: the desired center value (Scalar, Table, Matrix, Raster)

Matrix Output.Filename: name of the output matrix

 

Who rated this article