MATLAB: Create a logical vector

logical_vectorneuroscience

Hi All,
I have a cell array, where each cell in the first row contains a double of various lengths. Each double corresponds to sample numbers where a spike occurs (from a neuron – variable called cluster_split). I also have created an array of 0's the length of signal I am interested in (variable called LFP). I would like to index across each double (i.e.: cluster_split{1,1}) and create a logical vector of 1's and 0's.
For example, if in cluster_split{1,1} there is a value equal to 2502 (corresponding to sample 2502 in the LFP vector), then Matlab would output a 1 to the LFP array. I would like to create a separate "LFP" file for every double in the cluster_split cell array.
Thanks in advance for the help!
PK

Best Answer

Does this help?
LFP = false(1, 3000);
LFP(2500) = true;
If LFP is at millisecond resolution and a spike occurs at 2500 milliseconds, you'll see a 1 in position 2500. Since I used true/false the vector is logical.