read spike data in Matlab

View previous topic View next topic Go down

read spike data in Matlab

Post  victorteleco on Thu Jun 21, 2012 12:45 am

Hello,

I have some trouble reading spike data in Matlab. I have copied mcintfac folder from MCStreamSupport to Matlab\toolbox\ and I can use its functions. First I load the .mcd file

file = datastrm('reg1.mcd');

and I can get some information from it doing this:

SpikeInfo = getfield(file, 'StreamInfo', {2})

My file only has two streams 'Trigger 1' and 'Spikes 2'.

I want to get the timestamps from the spikes of every electrode and, if possible, its waveforms, and I don't know how to do it.
Could you help me?

Thanks,

Víctor.

victorteleco

Posts : 8
Join date : 2012-06-21

View user profile

Back to top Go down

Re: read spike data in Matlab

Post  Jens on Thu Jun 21, 2012 7:24 pm

The "mcintfac"-interface is no longer actively supported.

Please consider to use Neuroshare to read the data.
You can download the latest version of our dll here:
http://www.multichannelsystems.com/software/neuroshare
The Neuroshare to Matlab interface can be downloaded here:
http://neuroshare.sourceforge.net/download.shtml

Then following command should be sufficient to access spike data
[nsresult] = ns_SetLibrary('nsMCDlibrary.dll')
[nsresult, hfile] = ns_OpenFile('NeuroshareExample.mcd')

[nsresult,entity] = ns_GetEntityInfo(hfile,x)
[nsresult,segment] = ns_GetSegmentInfo(hfile,x)
[nsresult, segmentsource] = ns_GetSegmentSourceInfo(hfile,8,x)
[nsresult,timestamp,data,samplecount,unitid] = ns_GetSegmentData(hfile,x,i)

x is the entity number of the channels containing spikes
i is the the Item of the entity which should be accessed

Best Jens

Jens

Posts : 55
Join date : 2009-03-05
Location : Multi Channel Systems

View user profile http://www.multichannelsystems.com

Back to top Go down

Re: read spike data in Matlab

Post  victorteleco on Wed Jun 27, 2012 11:26 pm

Hello,

I've downloaded nsMCDLibrary and I've followed the steps for using this library as the manual says. I downloaded FIND and decompress it in Program Files and now I get this error

NEV file could not be loaded!

nsresult =

-2


I do the following:

cd 'C:\Program Files\FIND'

[nsresult] = ns_SetLibrary('nsMCDlibrary.dll')
[nsresult, hfile] = ns_OpenFile('C:\Example.mcd')
[nsresult,entity] = ns_GetEntityInfo(hfile,1)

The error is produced when Matlab tries to open the file. I have tried using other .mcd file even the example file included with Neuroshare.

What can I do now?

victorteleco

Posts : 8
Join date : 2012-06-21

View user profile

Back to top Go down

Re: read spike data in Matlab

Post  Jens on Thu Jun 28, 2012 8:12 pm

What shows

[nsresult,info] = ns_GetLibraryInfo()

Jens

Posts : 55
Join date : 2009-03-05
Location : Multi Channel Systems

View user profile http://www.multichannelsystems.com

Back to top Go down

Re: read spike data in Matlab

Post  victorteleco on Thu Jun 28, 2012 10:57 pm

nsresult =

0


info =

LibVersionMaj: 2
LibVersionMin: 1
APIVersionMaj: 1
APIVersionMin: 3
Description: 'neuroshare Library to import Multi Channel Systems data files'
Creator: 'Multi Channel Systems'
Time_Year: 2007
Time_Month: 2
Time_Day: 16
Flags: 'NONE'
MaxFiles: 256
FileDescCount: 1
FileDesc: [1x1 struct]

victorteleco

Posts : 8
Join date : 2012-06-21

View user profile

Back to top Go down

Re: read spike data in Matlab

Post  Jens on Thu Jun 28, 2012 11:33 pm

You version of nsMCDLibrary is 2.1
Please try the latest version which is 3.4

Jens

Posts : 55
Join date : 2009-03-05
Location : Multi Channel Systems

View user profile http://www.multichannelsystems.com

Back to top Go down

Re: read spike data in Matlab

Post  victorteleco on Mon Jul 02, 2012 12:15 am

I've realized that I was using the version 2.1.0 of nsMCDLibrary.dll because of FIND so I've copied the latest version of the dll to FIND's directory. Now this is my matlab code

cd 'C:\Archivos de programa\FIND'

[nsresult] = ns_SetLibrary('nsMCDlibrary.dll')
[nsresult, hfile] = ns_OpenFile('C:\Documents and Settings\Víctor\Escritorio\mcd\Matlab\id48-05-09-ctrl.mcd')

[nsresult,entity] = ns_GetEntityInfo(hfile,1)

[nsresult,info] = ns_GetLibraryInfo()
[nsresult,segment] = ns_GetSegmentInfo(hfile,1)
[nsresult, segmentsource] = ns_GetSegmentSourceInfo(hfile,8,1)
[nsresult,timestamp,data,samplecount,unitid] = ns_GetSegmentData(hfile,1,2)


and I get this error

Some entities do not exist (ns_GetSegmentInfo).
ns_GetSegmentInfo returned a ZERO sample count for the data!
(Required for ns_GetSegmentData)
??? Undefined function or method 'log2' for input arguments of type 'char'.

Error in ==> ns_GetSegmentData at 58
UnitID(ind) = log2(UnitID(ind));

Error in ==> spikes1 at 14
[nsresult,timestamp,data,samplecount,unitid] = ns_GetSegmentData(hfile,1,2)

victorteleco

Posts : 8
Join date : 2012-06-21

View user profile

Back to top Go down

Re: read spike data in Matlab

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum