Plotting Cells from a Cell array in order to create a raster plot. Please Help

6 views (last 30 days)
I am having trouble with plotting the cells from a cell array. The array has 158 cells of varying sizes and i wish to plot them on a raster plot with 8 different graphs. So far I have :
for i = 1:8
indDir1 = find(direction==1);
indDir2 = find(direction==2);
indDir3 = find(direction==3);
indDir4 = find(direction==4);
indDir5 = find(direction==5);
indDir6 = find(direction==6);
indDir7 = find(direction==7);
indDir8 = find(direction==8);
indDir = [indDir1;indDir2;indDir3;indDir4;indDir5;indDir6;indDir7;indDir8];
numTrials = length(indDir);
subplot(3,3,graph(i));hold on; % this is all for the is not the issue
for i = 1: size(instruction)
spiketimes{i} = num2cell(neuron1.times(neuron1.times(:,1) >= instruction1sb(i) &
neuron1.times(:,1) < instruction1sa(i)))
end; % This is how i created the cell array with 158 cells for each trial
for j = [1:numTrials];
n = length(spiketimes);
% Here is where I have no idea how to plot these cells
plot([spiketimes ;spiketimes ], [ones(n,1)*j-1; ones(n,1)*j]);
Please help!!!
Shane Hagen
Shane Hagen on 22 Mar 2015
Edited: Shane Hagen on 22 Mar 2015
I have moved forward with this:
for j = 1:158
n = length(spiketimes);
spiketimes(ix)={0} ;
for ii = [4,16,20,32,36,89,111,119,129,156] % Here I turned NaN values to 0 then into an empty cell
a = spiketimes {ii}; if a==0 spiketimes{ii} = cell{1};
%n = length(results(j,:));
%result(j) = spiketimes{j}; % not sure ifll end up needing these
line([spiketimes{j,1} ; spiketimes{j,1}],[ones(1,n)*j-1;ones(1,n)*j],'k-');
end; end;
Error using line Conversion to double from cell is not possible. % This is the error im currently getting
PLease...anyone..I would really appreciate the help. I need to be able to plot this. Eventually im going to have to assign these plots for different direction but for now im just trying to get past plotting the cells

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by