I'm wondering if it is possible to use if logic to change values in an array for only some of the values based on the condition. For example, If value is negative, sub in zero.
-
Official comment
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
Please sign in to leave a comment.
Comments
2 comments