I need this code altered due to a new EMG recording system. I have the original code attached. I need the ENG data to be acquired and plotted as 5 separate plots.
Plot 1 = electrode 1
Plot 2 = electrode 2
Plot 3 = electrode 3
plot 4 = electrode 4
plot 5 = a snapshot of electrode 4, based on incoming signal from a device
I want the y axis to be fixed for each subplot of -1 to +1. The x axis should go from 0 to the max # of samples taken (set b4 scripts starts)
Plot 5 will be the most complex. I need it to update and display the signal each time stimulus is delivered to the subject. "Device2" is a nidaq usb-6009 DAQ card that will be receivng input (+ 5 volts via a BNC cable) that tells MATLAB when the stimulation machine has fired. I need this input to drive plot 5. Everytime this input is seen, I want plot 5 to plot 200 ms of data surrounding that moment (data is sampled at 1000Hz). This snapshot will stay up until the next time the device fires and send another signal to the DAQcard. I would like plot5 to be updated with the new windows of 200 ms. the 200ms windows should be the 50ms before the incoming signal and 150ms after. I also want the 3 previous windows kept on the same plot, only in a diffrent color from the latest signal. I also want the plot to calculate and display the min to max size (amplitude) of the EMG signal we are measuring. See Data set for an example. These are called MOTOR EVOKED POTENTIALS. and are the signal we are trying to examine.
I have attached a simple EMG aquistion script I use and a more complex one. The more complex ("TMS_Force....) script uses a force sensor to drive the plotting. You can ignore and remove any force sensor related data acquisition and plotting from the code. Feel free to use as much of the original code as you want. I only need this to record EMG, save it to a file (name specified in by user in code before it starts). I would also like the user to specify the length of recording, in seconds, in the code as well. See code for specific.
Device3 = the EMG data channels. There will be 4 channels of data.
Device2 = the usb6009 that should receive incoming pulses every time the device fires (has 4 channels. 0,1,2,3, please use 1). The 1st 4 plots should be continuous, never updating or changing, just showing the data (EMG) in real time.
I have attached a sample of the data so you know what it looks like.
If you have any Qs, please let me know. THis is a rush job, so a bonus will be paid if it can be done in 24 hours from posting. I can work with coder to troubleshoot the code online ASAP.