Changing only a portion of array values




  • Official comment
    Paul Haby

    Substitution of values within a vector can be accomplished using an IF statement in an Expression element as follows:

    Use an IF statement to evaluate values within the vector and make a conditional adjustment to values meeting the criteria:

    Comparison of the original vector and the resulting vector after the negative values have been replaced with zero:


    In the case of a matrix, a modified syntax is required for all elements of the matrix (rows and columns) to be evaluated:

    Original matrix:

    IF statement within Expression element:

    Resulting matrix:


    Individual elements in an array can also be selectively modified by using a Data element and selectively editing array positions:



    Comment actions Permalink
  • Avatar
    Rebecca Hurtubise

    Thank you Paul, I was able to get this working in my model. 

    Comment actions Permalink

Please sign in to leave a comment.