This example shows how to process multiple input signals. You can create such script windows only by using Control Window.

In the process function, we expect to get two input signals. The resulting signal will contain maximal values from these two signals by using element-wise comparison. Other signal properties like units, x-axis, length etc. will be taken from the first input signal.

function process( input_windows::Array{SigviewWindow}, output_signal::SigviewSignalWindow )

  #create empty array for the result

  output_signal.samples = Array{Float32}( undef, length(input_windows[1].samples) )

  #iterate through both input arrays (until the length of the first one) and place the max value in result array

  #can be done more efficient with Julia, loop example for simplicity

  for i= 1:length(input_windows[1].samples)

       output_signal.samples[i] = input_windows[1].samples[i] > input_windows[2].samples[i] ? input_windows[1].samples[i] : input_windows[2].samples[i]


  #set sample rate and x axis the same as in the first input signal

  output_signal.samplingRate = input_windows[1].samplingRate

  output_signal.xAxisBegin = input_windows[1].xAxisBegin

  output_signal.xAxisUnit = input_windows[1].xAxisUnit

  output_signal.yAxisUnit = input_windows[1].yAxisUnit

  return true