Print

Print


Dear Erie, 

For that particular operation you could use higher level SPM functions. To select a time window and drop the rest you could use the 'Crop' tool (spm_eeg_crop). And to select only a subset of trials you could mark the other trials as bad and then use 'Remove bad trials' tool (spm_eeg_remove_bad_trials) to remove them.


The lower-level way is to use the clone method which can create an empty dataset while preserving some header information. So you could do:

D_new = clone(D, 'newname', [D.nchannels, nsamples_new, ntrials_new], 2);

Then you would need to copy the data from D to D_new with something like

 D_new(:, :, :)=D(:,3000:7200,2:75);

and then you might need to adjust things like trial labels or bad flags because clone can't figure those things out automatically. So

D_new = conditions(Dnew, ':', D.conditions(2:75));
D_new = badtrials(Dnew, ':', D.badtrials(2:75));

save(D_new);


Best,

Vladimir




On Thu, Jul 10, 2014 at 10:34 AM, Erie Boorman <[log in to unmask]> wrote:
Dear Vladimir, 

Thank you for your swift reply. I'm afraid I'm still having trouble working out how to use clone, as I'm new to SPM. What I would like to do is create a new data object that is re-epoched. For example in Matlab I would do the following: D_new=D(:,3000:7200,2:75);

How would you do this with clone? 

Best,
-Erie 

From: Vladimir Litvak [[log in to unmask]]
Sent: Wednesday, July 09, 2014 9:44 PM
To: Erie Boorman
Cc: [log in to unmask]
Subject: Re: [SPM] Modifying a M/EEG data object

Dear Erie,

What you need is the 'clone' method (help meeg/clone). You could see a usage example I'm e.g spm_eeg_crop.

Best,

Vladimir



On 9 Jul 2014, at 17:59, Erie Boorman <[log in to unmask]> wrote:

Hello, I'm using SPM to analyse some LFP data which has been epoched using EEG lab. However I would like to modify the size of the data object in SPM, creating a new data object so that I can run SPM functions and methods on that new data object. To be more concrete, my data object is currently 56 channels, 23986 samples/trial, 75 trials. I would like to create two different data objects that are different sizes which basically take portions of the existing data object. Could somebody suggest how to do this? 

Many thanks in advance,
-Erie