How to read and write Matlab data in MatlabFilter.cpp?
Posted: 25 Sep 2011, 09:35
Hi,
I'm a newby in BCI2000, I'm using Matlab signal processing and it was work out well. But I still have a problem that I want to record data after Matlab operation and I found that I would save it into text file at MatlabFilter.cpp. And my code go like these
void
MatlabFilter::Process( const GenericSignal& Input, GenericSignal& Output )
{
StatesToMatlabWS();
MatlabEngine::PutMatrix( IN_SIGNAL, Input );
if( CallMatlab( *mpBci_Process ) )
Output = MatlabEngine::GetMatrix( OUT_SIGNAL );
else
Output = Input;
myfile << Output;
MatlabWSToStates();
}
This code resulted this .txt file below
SignalProperties { % 1 128 float32 0 1 % 0 0 0 1 % 0 127 {0 1 % -1 1 }
}
3.092456
3.071291
3.008183
2.904283
2.761489
2.582401
2.370271
2.128939
1.862758
1.576502
1.275275
0.9644084
0.649355
0.3355827
0.02846679
-0.2668147
-0.5453811
-0.8027421
....down to 128 rows from 128Hz
But what I really want is all data from all 14 channel ( I use Emotiv EPOC ) not only one channel. So would anyone please help me to figure it out? Thank you for your help in this warm social environment
Best regard,
Aug
I'm a newby in BCI2000, I'm using Matlab signal processing and it was work out well. But I still have a problem that I want to record data after Matlab operation and I found that I would save it into text file at MatlabFilter.cpp. And my code go like these
void
MatlabFilter::Process( const GenericSignal& Input, GenericSignal& Output )
{
StatesToMatlabWS();
MatlabEngine::PutMatrix( IN_SIGNAL, Input );
if( CallMatlab( *mpBci_Process ) )
Output = MatlabEngine::GetMatrix( OUT_SIGNAL );
else
Output = Input;
myfile << Output;
MatlabWSToStates();
}
This code resulted this .txt file below
SignalProperties { % 1 128 float32 0 1 % 0 0 0 1 % 0 127 {0 1 % -1 1 }
}
3.092456
3.071291
3.008183
2.904283
2.761489
2.582401
2.370271
2.128939
1.862758
1.576502
1.275275
0.9644084
0.649355
0.3355827
0.02846679
-0.2668147
-0.5453811
-0.8027421
....down to 128 rows from 128Hz
But what I really want is all data from all 14 channel ( I use Emotiv EPOC ) not only one channel. So would anyone please help me to figure it out? Thank you for your help in this warm social environment
Best regard,
Aug