Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Dear All,
I am trying to assign the back to the largest value matrix within the gap =6 back to the range, i.e. 1 to 6, 6 to 12 and 12 to 18 and so on .. What is a suitable program and looping to do compare and reassign the largest value back to the range of matrix.
Solved! Go to Solution.
Unfortunately you did not provide a specific example of the vector you expect as a result and you did not answer the question what to do if the number of rows of M is not a multiple of gap!
As far as I understood you expect a result vector of the same length as M.
I also assumed that the last sub-matrix may be of a smaller size than gap if the rows in M are not a multiple of gap.
So here is my approach.
Attached file in Prime 9 format
Can you explain in more detail what you are trying to achieve?
A few examples (input values AND the vector you expect as output) could help.
Also cover the case what should happen if the number of rows in M is not a multiple of gap.
Hi Werner,
Thanks for your reply. I am trying get the max value from M1 to M6, then M7 to M12 and so on, then reasign the maximum values within this range back to the range, for example, M1 to M6 = 0, 1, 2, 0, 2, 1, the maximum value is 2, therefore answer for M1 to M6 shall be 2.
Unfortunately you did not provide a specific example of the vector you expect as a result and you did not answer the question what to do if the number of rows of M is not a multiple of gap!
As far as I understood you expect a result vector of the same length as M.
I also assumed that the last sub-matrix may be of a smaller size than gap if the rows in M are not a multiple of gap.
So here is my approach.
Attached file in Prime 9 format
Thanks Werner, this actually works....
Assuming that your vector length is an integer number times the value of gap, this function could be what you're looking for:
With this example vector:
With various values of gap, results are:
Success!
Luc
Thank Luc, this solved the calculation I needed.