Hey everyone,
I have a new issue. I'm working offline using the command line processing and importing then the results in matlab. But when I compare my data imported in matlab using the load_bcidat() function to the data generated by the command line " bci_dat2stream < mydata.dat | TransmissionFilter | bci_stream2mat > mydata.mat " and then loaded into matlab using the function " [ signal, 'StimulusCode' ] = load_bcimat( 'mydata.mat', 2, 'StimulusCode' ); " I get a constant offset. In other words the signals imported using load_bcidat() function are constantly shifted down with respect to those imported using the load_bcimat() function.
Can you please help me understand what I'm doing wrong.
Thanks,
Alessandro
Command line processing and matlab
-
dyd1985
- Posts: 23
- Joined: 13 May 2010, 11:19
Command line processing and matlab
- Attachments
-
- fig.tif (234.24 KiB) Viewed 10136 times
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: Command line processing and matlab
Hi Alessandro,
data can be read from file applying the "calibration" given by the SourceChOffsets and SourceChGains parameters, or in raw A/D units.
The default for load_bcidat() is to load data uncalibrated, i.e. in raw A/D units. To apply calibration to the data, specify the '-calibrated' option as an additional parameter to load_bcidat().
The default for bci_dat2stream, on the other hand, is to read data calibrated. To read data uncalibrated with bci_dat2stream, use the '--raw' option on the command line.
Now, when you have a nonzero value in SourceChOffsets, and a SourceChGain value of 1, and when you are using the default for both load_bcidat() and bci_dat2stream, you will have a constant offset between the data read by the two methods.
Best regards,
Juergen
data can be read from file applying the "calibration" given by the SourceChOffsets and SourceChGains parameters, or in raw A/D units.
The default for load_bcidat() is to load data uncalibrated, i.e. in raw A/D units. To apply calibration to the data, specify the '-calibrated' option as an additional parameter to load_bcidat().
The default for bci_dat2stream, on the other hand, is to read data calibrated. To read data uncalibrated with bci_dat2stream, use the '--raw' option on the command line.
Now, when you have a nonzero value in SourceChOffsets, and a SourceChGain value of 1, and when you are using the default for both load_bcidat() and bci_dat2stream, you will have a constant offset between the data read by the two methods.
Best regards,
Juergen
-
dyd1985
- Posts: 23
- Joined: 13 May 2010, 11:19
Re: Command line processing and matlab
Dear Juergen,
thank you so much for your reply.
I imported in Matlab the signals as calibrated, in both cases. Default for load_bcimat() and '-calibrated' mode for load_bcidat(). Moreover I have made sure that SourceChOffset is set to zero and SourceChGain (that gives calibrated units) is non-zero. With these settings I'm getting the offset you can see in the figure I attached. I can't find yet where I'm wrong.
Thank you so much.
Alessandro
thank you so much for your reply.
I imported in Matlab the signals as calibrated, in both cases. Default for load_bcimat() and '-calibrated' mode for load_bcidat(). Moreover I have made sure that SourceChOffset is set to zero and SourceChGain (that gives calibrated units) is non-zero. With these settings I'm getting the offset you can see in the figure I attached. I can't find yet where I'm wrong.
Thank you so much.
Alessandro
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: Command line processing and matlab
Dear Alessandro,
could you send me the data file in question, so I can try myself?
Best regards,
Juergen
could you send me the data file in question, so I can try myself?
Best regards,
Juergen
-
dyd1985
- Posts: 23
- Joined: 13 May 2010, 11:19
Re: Command line processing and matlab
mellinger wrote:Dear Alessandro,
could you send me the data file in question, so I can try myself?
Best regards,
Juergen
Sure.
I have attached the acquisition run I have used.
Thank you so much for your help.
Alessandro
- Attachments
-
- yuriS001R07.rar
- (3.58 MiB) Downloaded 804 times
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: Command line processing and matlab
Hi Alessandro,
I cannot find a significant difference between files loaded by load_bcidat vs load_bcimat.
This is what I did: First I executed on the command line:
Then, in Matlab:
In the plot, only very small differences showed up, due to the different numeric types involved (load_bcimat returns data in single format, load_bcidat in double format).
Regards,
Juergen
I cannot find a significant difference between files loaded by load_bcidat vs load_bcimat.
This is what I did: First I executed on the command line:
Code: Select all
bci_dat2stream < yuriS001R07.dat | TransmissionFilter | bci_stream2mat > yuriS001R07.mat
Code: Select all
>> m = load_bcimat( 'yuriS001R07.mat', 2 );
>> norm(m)
ans =
1.1217e+004
>> d = load_bcidat( 'yuriS001R07.dat', '-calibrated' );
>> norm(d)
ans =
1.1217e+004
>> delta=d-m;
>> norm(delta)
ans =
1.3201e-004
>> figure;plot(delta);
Regards,
Juergen
-
dyd1985
- Posts: 23
- Joined: 13 May 2010, 11:19
Re: Command line processing and matlab
Thanks Juergen.mellinger wrote:Hi Alessandro,
I cannot find a significant difference between files loaded by load_bcidat vs load_bcimat.
This is what I did: First I executed on the command line:Then, in Matlab:Code: Select all
bci_dat2stream < yuriS001R07.dat | TransmissionFilter | bci_stream2mat > yuriS001R07.matIn the plot, only very small differences showed up, due to the different numeric types involved (load_bcimat returns data in single format, load_bcidat in double format).Code: Select all
>> m = load_bcimat( 'yuriS001R07.mat', 2 ); >> norm(m) ans = 1.1217e+004 >> d = load_bcidat( 'yuriS001R07.dat', '-calibrated' ); >> norm(d) ans = 1.1217e+004 >> delta=d-m; >> norm(delta) ans = 1.3201e-004 >> figure;plot(delta);
Regards,
Juergen
This is really helpful. I really appreciated your help.
Alessandro
Who is online
Users browsing this forum: No registered users and 0 guests
