Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
How do I find the name of the variable that has the maximum value in a set of data. For example, if I have x=3, y=5 and z=2. I want to find the variable name for the maximum value. In this case it would be "y".
Solved! Go to Solution.
Unfortunately Prime offers no way to access the NAMES of variables.
But if you collect all values in a vector, you cannot only find the maximum value but also the positions, the indices where in the vector this value occurs. Notice that by default the first element has the index 0.
Unfortunately Prime offers no way to access the NAMES of variables.
But if you collect all values in a vector, you cannot only find the maximum value but also the positions, the indices where in the vector this value occurs. Notice that by default the first element has the index 0.
Thank you for your response! I was able to take what you said one step further. I am not worried about repeating numbers. I am just trying show the maximum moment on a beam with different load cases.
You could also use the lookup() function to do the job.
But nonetheless it is still necessary to define a separate vector with the "names".
This question does not appear to be well formulated. One reason that many of us use Mathcad is that it is "unit aware", How should it compare variables with different SI types unless, as Werner hints, you first collect all your variables into groups of common types and the look for the maximum of each type.
But then, how do you compare these maximums?