The data format exported by Saleae Logic is quite interesting. To plot a signal, you need two variables from the export: ``digital_channel_initial_bitstates'' and ``digital_channel_X'' where X is the channel you need and we start from 0.
The idea to plot a single channel is, that first you must know the initial state of the signal, this is saved in ``digital_channel_initial_bitstates''. The first element belongs to the first channel, etc. If the bit is zero, your signal starts with a zero; if its one, then the signal starts with a one.
Now, the ``digital_channel_0'' does not contain your signal in a format you are usually working in Matlab, instead these are state encoded. Say, the format contains the numbers 23,32,27,100... This would mean, that the signal was the initial state for 23 samples, then flipped to the other state for 32 samples, than flipped again for 27 samples and so on. That is exactly you want to do: create a vector of 23 ones and multiply it by the initial state. Flip the state. Augment it by 32 samples and multiply it by the fliped state again... And so on and so on.
So, to plot the singal (vs. sample index) you can use the following piece of code:
If you want to plot the data against time, you need to determine the sampling period from the sampling frequency, then you can create a time vector according to the length of the samples. So to plot your capture vs. time, you can use:
If you want to overlay the output of the Analyzer that is also exportable to CSV format, well... that's not so easy to do. The main problem is, that the export format from the Saleae Logic is not the best, the guys at Saleae could improve it. The way it is exported is, that it contains time markers, which I guess belong to the beginning of frames (like the start bit in serial) and it has a bit of text assigned to it. But the issue is, that the beginning of the timer (0) is not in a clear relashionship with the capture data frames (you don't know where it begins), frame ends are not exported etc... It is usable in some cases, but convoluted.