1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- % based on sample code here: https://neo.readthedocs.io/en/0.8.0/io.html#neo.io.NeoMatlabIO
- block = struct();
- block.segments = { };
- block.name = 'my block with matlab';
- for s = 1:3
- seg = struct();
- seg.name = strcat('segment ',num2str(s-1));
- seg.analogsignals = { };
- for a = 1:5
- anasig = struct();
- anasig.name = ['sig ', num2str(a-1)];
- anasig.signal = rand(600,1);
- anasig.signal_units = 'mV';
- anasig.t_start = 0;
- anasig.t_start_units = 's';
- anasig.sampling_rate = 20;
- anasig.sampling_rate_units = 'Hz';
- seg.analogsignals{a} = anasig;
- end
- seg.spiketrains = { };
- for t = 1:7
- sptr = struct();
- sptr.name = ['st ', num2str(t-1)];
- sptr.times = rand(30,1)*30;
- sptr.times_units = 's';
- sptr.t_start = 0;
- sptr.t_start_units = 's';
- sptr.t_stop = 30;
- sptr.t_stop_units = 's';
- seg.spiketrains{t} = sptr;
- end
- event = struct();
- event.name = 'event 0';
- event.times = [0, 10, 30];
- event.times_units = 's';
- event.labels = ['trig0'; 'trig1'; 'trig2'];
- seg.events{1} = event;
- epoch = struct();
- epoch.name = 'epoch 0';
- epoch.times = [10, 20];
- epoch.times_units = 's';
- epoch.durations = [4, 10];
- epoch.durations_units = 's';
- epoch.labels = ['a0'; 'a1'];
- seg.epochs{1} = epoch;
- block.segments{s} = seg;
- end
- save 'neo-matlab.mat'
|