Finding max values across multiple channels


Recommended Posts

How can I combine multiple channels to be the max at each time point?  For instance, let's say I have three channels as per below.

Temp1[0,3] = {5, 12, 43, 2}

Temp2[0,3] = {7, 9, 6, 8}

Temp3[0,3] = {8, 7, 7, 8}

I want to know the max value at each time I want the below resulting array...

maxTemp = {8, 12, 43, 8}

Link to comment
Share on other sites

You'd have to combine that into a single array, then do maxcols() on it:

private arr = temp1[0,3]
arr[][1] = temp2[0,3]
arr[][2] = temp3[0,3]
private maxTemp = maxcols(arr)

So, the max() function takes the maximum across the first (rows) dimension and is always the one with time associated.  It is the most common form since most arrays are only 1 dimensional.  MaxCols() takes the maximum across the second (column) dimension.  We build up arr as an array with 4 rows and 3 columns, one column for each channel.  By doing maxCols() we are saying we want the maximum for each row (in time), across all columns.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.