<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Contributions%3ABCI2000MatlabInterface</id>
	<title>Contributions:BCI2000MatlabInterface - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Contributions%3ABCI2000MatlabInterface"/>
	<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:BCI2000MatlabInterface&amp;action=history"/>
	<updated>2026-06-27T12:51:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:BCI2000MatlabInterface&amp;diff=11707&amp;oldid=prev</id>
		<title>Wengelhardt at 16:40, 7 January 2025</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:BCI2000MatlabInterface&amp;diff=11707&amp;oldid=prev"/>
		<updated>2025-01-07T16:40:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:40, 7 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;BCI2000Remote is an interface to the BCI2000 Operator module, that allows to start-up, configure, and run BCI2000 from other applications. For more BCI2000 Operator module commands, please refer to [[User_Reference:Operator_Module_Scripting]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;BCI2000Remote is an interface to the BCI2000 Operator module, that allows to start-up, configure, and run BCI2000 from other applications. For more BCI2000 Operator module commands, please refer to [[User_Reference:Operator_Module_Scripting]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Examples==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Examples==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight lang=&quot;matlab&quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;%% c library load, initial part&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;%% c library load, initial part&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;clc;clear;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;clc;clear;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot;&gt;Line 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     pause(1);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     pause(1);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb-bci_:diff:1.41:old-9279:rev-11707:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Wengelhardt</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:BCI2000MatlabInterface&amp;diff=9279&amp;oldid=prev</id>
		<title>Lingling: Version 1</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:BCI2000MatlabInterface&amp;diff=9279&amp;oldid=prev"/>
		<updated>2021-12-21T17:33:13Z</updated>

		<summary type="html">&lt;p&gt;Version 1&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Synopsis==&lt;br /&gt;
This is an example that controlling BCI2000 under Windows from MATLAB.&lt;br /&gt;
Matlab is able to interface with dynamic libraries(.dll,.so,.dylib) if a header file is available.(http://www.mathworks.com/help/matlab/using-c-shared-library-functions-in-matlab-.html). Thus we can load the  [[Programming Reference:BCI2000Remote Class#BCI2000RemoteLib|BCI2000RemoteLib]] library by specifying &amp;lt;tt&amp;gt; prog/BCI2000RemoteLib.dll&amp;lt;/tt&amp;gt; as C shared library and  &amp;lt;tt&amp;gt;src/core/Operator/BCI2000Remote/BCI2000RemoteLib.h&amp;lt;/tt&amp;gt; as header file when calling MATLAB&amp;#039;s &amp;lt;tt&amp;gt;loadlibrary&amp;lt;/tt&amp;gt; function. When using BCI2000RemoteLib this way, your MATLAB code will run on all platforms supported by BCI2000, and no COM registration will be required on Windows systems.&lt;br /&gt;
===Author===&lt;br /&gt;
Huiling Huang &amp;lt;huiling@neurotechcenter.org&amp;gt;&lt;br /&gt;
==Functional Description==&lt;br /&gt;
BCI2000Remote is an interface to the BCI2000 Operator module, that allows to start-up, configure, and run BCI2000 from other applications. For more BCI2000 Operator module commands, please refer to [[User_Reference:Operator_Module_Scripting]]&lt;br /&gt;
==Examples==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%% c library load, initial part&lt;br /&gt;
clc;clear;&lt;br /&gt;
if not(libisloaded(&amp;#039;bci&amp;#039;))&lt;br /&gt;
    loadlibrary(&amp;#039;C:\BCI2000.x64\prog\BCI2000RemoteLib&amp;#039;,&amp;#039;C:\BCI2000.x64\src\core\Operator\BCI2000Remote\BCI2000RemoteLib.h&amp;#039;, &amp;#039;alias&amp;#039;, &amp;#039;bci&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
libfunctions(&amp;#039;bci&amp;#039;)&lt;br /&gt;
%need to call BCI2000Remote_Delete to recovery the memory&lt;br /&gt;
bciHander = calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_New&amp;#039;);&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_SetOperatorPath&amp;#039;, bciHander,&amp;#039;C:/BCI2000.x64/prog/Operator&amp;#039;);&lt;br /&gt;
if calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Connect&amp;#039;, bciHander) ~= 1&lt;br /&gt;
    fprintf(&amp;#039;bci connect fail!&amp;#039;)&lt;br /&gt;
    calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Delete&amp;#039;, bciHander);&lt;br /&gt;
    return&lt;br /&gt;
end&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Execute&amp;#039;, bciHander,&amp;#039;Change directory $BCI2000LAUNCHDIR&amp;#039;,0);&lt;br /&gt;
&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_SetWindowVisible&amp;#039;, bciHander,1);&lt;br /&gt;
modules = libpointer(&amp;#039;stringPtrPtr&amp;#039;, {&amp;#039;SignalGenerator&amp;#039;, &amp;#039;SpectralSignalProcessing&amp;#039;, &amp;#039;CursorTask&amp;#039;});&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_StartupModules2&amp;#039;, bciHander, modules, 3);&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_LoadParametersRemote&amp;#039;, bciHander, &amp;#039;../parms/examples/CursorTask_SignalGenerator.prm&amp;#039;);&lt;br /&gt;
%%&lt;br /&gt;
%add states&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_AddStateVariable&amp;#039;, bciHander,&amp;#039;matlab&amp;#039;,8, 0);&lt;br /&gt;
&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_SetConfig&amp;#039;, bciHander);&lt;br /&gt;
&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Execute&amp;#039;, bciHander,&amp;#039;Show window watches&amp;#039;,0);&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Execute&amp;#039;, bciHander,&amp;#039;visualize watch matlab&amp;#039;,0);&lt;br /&gt;
%start&lt;br /&gt;
calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_Start&amp;#039;, bciHander);&lt;br /&gt;
pause(5);&lt;br /&gt;
&lt;br /&gt;
%% send the behavior data to BCI2000&lt;br /&gt;
for i = 1:10&lt;br /&gt;
    calllib(&amp;#039;bci&amp;#039;, &amp;#039;BCI2000Remote_SetStateVariable&amp;#039;, bciHander,&amp;#039;matlab&amp;#039;, i);&lt;br /&gt;
    pause(1);&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
</feed>