Autoscaling with Min/Max for several channels


Recommended Posts

I have three channels with similar output ranges displayed on the same axis and I would like to set the range based on the min/max of all of these channels for the period being displayed.

For example, axis min expression: Min( { Min(CH_1[0,180]), Min(CH_2[0,180]), Min(CH_3[0,180]) } )

In practice I can't seem to nest the Min() and Max() functions correctly. Here's some output from testing in the command window:

? Max({1,2,3,4,5,6,7,8,9,0})
? Max({Max({1,2,3,4,5,6,7,8,9,0}),Max({1,2,3,4,5,6,7,8,9,0}),Max({1,2,3,4,5,6,7,8,9,0})})
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}}
? Max({Max({1,2,3}),Max({4,5,6}),Max({7,8,9})})
{{7, 8, 9}}
? Max(Max({Max({1,2,3}),Max({4,5,6}),Max({7,8,9})}))
{{7, 8, 9}}
? Max(Max({Max({1,2,3}),Max({4,5,6}),Max({7,8,9})})[0])
{{7, 8, 9}}
? Max(Max({Max({1,2,3}),Max({4,5,6}),Max({7,8,9})})[0][0])
? Max(U_m_s[0,30])
? Max(V_m_s[0,30])
? Max(W_m_s[0,30])
? Max({Max(U_m_s[0,30]),Max(V_m_s[0,30]),Max(W_m_s[0,30])})
? Max(Max({Max(U_m_s[0,30]),Max(V_m_s[0,30]),Max(W_m_s[0,30])})[0][0])

The second to last command is puzzling - I'd expect each Max(*_m_s[0,30]) to return a number which then becomes an element of a new array being passed into the outside Max() which would return the max of those three... that's not what's happening though and I'm stuck. Any ideas?

Link to comment
Share on other sites

Min, and max() take only one parameter, which it expects is an array. It then finds the max of that array. You can't do: max(x,y) as it will just return the max value in x. If x is a scalar, its just going to return that value. This is why your combination doesn't work. You need to use the concat() function to concatenate all your arrays, THEN call max() on the result.

Note that concat only works up to 20 different values. If you need to concat more, nest your concat()'s.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.