%script make_exampledata for Matlab PhD course to show usage of a structure
%for data handling.
% This script is part of the Matlab course for PhD Students 2010-2011:
% http://www.sinnesphysiologie.uni-oldenburg.de/50246.html
% This version was written by Jutta Kretzberg, 23.01.2011

%% generate example data set with random sequence of ones and zeros
exampledata=zeros(20,1000);
z=randperm(20000);
z=z(1:800);         % generate random indices     
exampledata(z)=1;   % set the corresponding elements to 1
exampledata=sparse(exampledata);    % sparse matrix

%% display the sparse matrix with an increased y-axis to make it better
% visible
spy(exampledata)
v=get(gca,'PlotBoxAspect');  %get current y-axis size
v(2)=10*v(2);
set(gca,'PlotBoxAspect',v);  %set new y-axis size
xlabel('time [ms]')
ylabel('trial nr')


%% clean up
clear z
clear v
