Changes

Jump to navigation Jump to search
5,242 bytes added ,  13:57, 21 September 2018
Created page with "<!---Start1---> = Paths and Folders = __TOC__ All files (e.g. functions or figures) and folders that are used in your experiment must be on the Http://www.mathworks.nl/help/..."
<!---Start1--->
= Paths and Folders =
__TOC__
All files (e.g. functions or figures) and folders that are used in your experiment must be on the [[Http://www.mathworks.nl/help/techdoc/matlab_env/br7ppws-1.htmlMatlabSearchPath|http://www.mathworks.nl/help/techdoc/matlab_env/br7ppws-1.html Matlab search path]].

<div id="AddFolders"></div>
== Adding folders to the search path ==

At startup, BrainStream adds the BrainStream core folder and nearly all its subfolders to the search path. If you need additional files or folders, you must make sure they are added to the search path. It is possible to specify these folders in the block file under the keys [.DocsSectionsBlockFile#TopicExperiment MatlabPathFnc] or [.DocsSectionsBlockFile#TopicExperiment MatlabPathAdd]. Alternatively, you can use Matlab's <tt>[[Http://www.mathworks.nl/help/techdoc/ref/addpath.htmlAddpath|http://www.mathworks.nl/help/techdoc/ref/addpath.html addpath]]</tt> function to add individual folders. If you want to add a folder with all its subfolders, use addpath in combination with <tt>[[Http://www.mathworks.nl/help/techdoc/ref/genpath.htmlGenpath|http://www.mathworks.nl/help/techdoc/ref/genpath.html genpath]]</tt>:
<pre>addpath(pwd); %adds the current working directory to the search path
addpath(genpath(pwd)); %adds the current working directory and all its subfolders to the search path
</pre>

It is often useful to write a user defined function that adds all necessary paths and execute this function at the start of the experiment (e.g. at the BS_INIT marker). For example, if the experiment needs access to functions that are located in the folder /Volumes/BCI/my_functions, you could make a function:
<pre>function event = add_folder(event)
addpath(fullfile('Volumes','BCI','my_functions')); % add my_functions folder to the Matlab search path</pre>

Then execute this function at the BS_INIT marker:
{|border="1"
|-
!colspan="3"| '''Actions Table'''
|-
| <strong> marker</strong> || <strong>time <br /></strong> || <strong>function <br /></strong>
|-
| BS_INIT || EVENT || add_folder
|}

=== Tip: Use the fullfile function ===

It is recommended to use Matlab's <tt>[[Http://www.mathworks.nl/help/techdoc/ref/fullfile.htmlFullfile|http://www.mathworks.nl/help/techdoc/ref/fullfile.html fullfile]]</tt> function when you specify a file or folder. This ensures that the proper folders will be added on computers with different operating systems, as different systems may use either '/' or '\' as a file separator.

<div id="RelativePath"></div>
=== Tip: Use relative path names ===

It is recommended to use relative path names when you specify a folder, whether it is in the blocksettings or in functions like <tt>addpath</tt>. This means that you specify the path name of the folder you want to add relative to a folder of which the location is already known. The advantage of using relative path names is that the proper folders will be added also if you work on a different computer.

In BrainStream, you can make use of the <tt>[.DocsSectionsProgrmmersGuide#bs_folder bs_folder]</tt> function. For example, with input argument 'BLOCK', the output of this function is the path to the folder containing the block file of the experiment. If the block file is located in '/Volumes/BCI/my_bci/blockfile', and you want to add a folder which contains your functions and is located in '/Volumes/BCI/my_bci/functions', you can specify this folder like this:
<pre>functionfolder = fullfile(bs_folder('BLOCK'),..,'functions') % N.B. the '..' expression means going up one level</pre>

<div id="OutputFolder"></div>

== Output folders ==

BrainStream saves output in the folder specified in the [.DocsSectionsBuildingExperiments#SecBlock block file] under topic Files and key [.DocsSectionsBlockFile#KeyOutFolder OutFolder].

The output folder contains:

'''subject folders''': a separate folder is created for each new subject. The folder has the subject's name.
<blockquote>

'''session folders''': a separate folder is created for each session with the same subject. The folder's name is the date of the session (YYYYMMDD).
<blockquote>

This folder contains the most recently saved version of user defined variables. This is the folder where BrainStream looks for variables when a 'load' statement is specified in the Actions table.

'''run folders''': a separate runfolder is created for each block within the experiment. The name of the folder is the name of the block followed by _ and a number indicating how many times this block has been repeated. Each runfolder contains:
<blockquote>

'''module folders:''' Each module stores its results in a separate folder named accordingly. [[BrainStream|Brain Stream]] always stores its result in the 'main' module.
<blockquote>

[.DocsSectionsLogFile log file]: gives an overview of everything that happened during your experiment.

brainstream folder: contains copies of the user defined variables that have been saved with a 'save' statement in the Actions table.

expdefs folder: contains copies of the experiment definition tables and blocksettings.

raw_bdf folder: contains the raw EEG data.
</blockquote></blockquote></blockquote></blockquote>

<!---End1--->

<!--
* Access control

-->

Navigation menu