Spike2 gives an error that sampling stopped
Here is how this problem was diagnosed and fixed on 2013-03-15:
A) The suggested errors by Spike 2 were:
1401 has lost mains power (the light was on, I did not think this was likely)
1401 data cable not securely plugged in (I plugged/replugged, no change)
bad mains noise spikes (I hoped not)
very high event input rates (I unplugged the 25 pin digital events cable and AH-HA, it worked!)
unused standard 1401 or 1401plus event inputs have a high rate (this is really the same as number 4)
B) Okay, so I established that there was something wrong with the digital event lines.
I reset and unplugged/replugged the 25 pin parallel cable and the USB cables. Problem still existed when the digital events were plugged in.
I unplugged the 3 cables going into the interconnect box. Spike2 worked. So now I thought the problem was 1 of these 3 cables.
I looked at all of those signals on the oscilloscope. The vertical refresh signal from the monitor exhibited high frequency noise with an amplitude of about 0.3V. I plugged in the other 2 signals...all worked. I plugged in the vertical refresh signal...failure. So, bingo, there was some problem with the vertical refresh signal.
I first suspected that I might just need to wiggle the switch box that switches between the monitor and LCD projector, but that was not the problem.
As I was playing, the connection between the video adapter on the Mac and the monitor splitter cable fell apart. I put them back together firmly and secured the connection with a cable tie. High frequency noise was gone. And everything now worked when plugged back in.
So I think the cable between the Mac's video adapter and the splitter cable got loose. It's fixed now and secured with a cable tie. I updated or re-did a few cable labels that were falling apart.
I accidentally didn't record a sync channel in LabView
If you recorded a data channel on Spike2 that is the same as one of the channels in LabView, you can perform the synchronization manually with the following steps.
Open the file in Spike2. Look at the signal that you recorded and try to find something interesting that might be easy to see in another recording of the same thing (like a funny spike shape, or a sequence of spikes).
In Matlab, read from the recorded channel in the vhlvanaloginput.vld file. Suppose you recorded the 3rd channel on Spike2, then you would use the following to read in data from the 3rd channel:
[T,D] = readvhlvdatafile('vhlv_analoginput.vld',,3,0,100); % reads data from LabView time 0 to 100 seconds
Find the precise time (in both records) of 2-3 features (short events like peak of spikes work best) at the beginning of the sample, and 2-3 features at the end of the sample. Record the time of these events on each record to a very high precision (like 6 digits or so). For example:
Then you can import this into Matlab:
X = [ 13.9286 10.07176
Calculate the linear fit (shift and scale) between the 2 records:
P = polyfit(X(:,1),X(:,2),1);
shift = P(2);
scale = P(1);
Write these results to the vhlv_lv2spike2time.txt file in the appropriate txxxxx directory:
dlmwrite([dirname filesep filename],[shift scale],'delimiter',' ','precision',15);