Changes

Jump to navigation Jump to search
Line 10: Line 10:  
'''get''':
 
'''get''':
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
general format implementation func:
 +
</blockquote>
   −
general format implementation func:
+
<pre>
</blockquote><pre>     function ret = get_fun(var, varargin)
+
      function ret = get_fun(var, varargin)
 
         get_fun: the function name of your dedicated ''get'' action   
 
         get_fun: the function name of your dedicated ''get'' action   
 
         var: the global variable
 
         var: the global variable
 
         varargin: any additional user input arguments  
 
         varargin: any additional user input arguments  
         ret: returned content derived from global variable  </pre><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px"> specification in the table: </blockquote><pre>     get_fun(field,varargin)</pre><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px"><blockquote>Notice the difference between function format and what is specified in your experiment definition table. In the table, the first argument <em>field </em>is the name of the ''event'' structure field that gets the content assigned. Also, the global variable ''var'' is automatically added as input argument by BrainStream, like this is also happening in the table for functions and the first ''event'' input argument.</blockquote></blockquote><pre>        field: content is stored in this field of local event structure
+
         ret: returned content derived from global variable   
        varargin: any additional user input arguments  </pre>
+
</pre>
 +
 
 +
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">  
 +
specification in the table:  
 +
</blockquote>
 +
 
 +
<pre>
 +
      get_fun(field,varargin)
 +
</pre>
    
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
<blockquote>
 +
<blockquote>
 +
Notice the difference between function format and what is specified in your experiment definition table. In the table, the first argument <em>field </em>is the name of the ''event'' structure field that gets the content assigned. Also, the global variable ''var'' is automatically added as input argument by BrainStream, like this is also happening in the table for functions and the first ''event'' input argument.
 +
</blockquote>
 +
</blockquote>
 +
</blockquote>
    +
<pre>
 +
        field: content is stored in this field of local event structure
 +
        varargin: any additional user input arguments 
 +
</pre>
 +
 +
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
examples:
 
examples:
<pre>get_item (data structures: array, shiftreg)  </pre><pre>load_var </pre></blockquote>
+
<pre>
 +
get_item (data structures: array, shiftreg)   
 +
load_var
 +
</pre>
 +
</blockquote>
    
'''put''':
 
'''put''':
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
general format implementation func:
 +
</blockquote>
   −
general format implementation func:
+
<pre>
<pre>function var = put_fun(var, update, varargin)</pre></blockquote><pre>      put_fun: the function name of your dedicated ''put'' action  
+
      function var = put_fun(var, update, varargin)
 +
        put_fun: the function name of your dedicated ''put'' action  
 
         var: the global variable
 
         var: the global variable
 
         update: content to update the global variable  
 
         update: content to update the global variable  
         varargin: any additional user input arguments </pre> <blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">specification table:</blockquote><pre>     put_fun(content,varargin)
+
         varargin: any additional user input arguments  
         update: content to update the global variable, i.e., a constant, function or name of event structure field (prefix name with a dot)  
+
</pre>  
         varargin: any additional user input arguments  </pre>
+
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">specification table:
 +
</blockquote>
 +
 
 +
<pre>
 +
      put_fun(content,varargin)
 +
         update: content to update the global variable, i.e., a constant,  
 +
                  function or name of event structure field (prefix name with a dot)  
 +
         varargin: any additional user input arguments   
 +
</pre>
    
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
examples:
 +
</blockquote>
   −
examples:
+
<pre>
</blockquote><pre>     put_item, push_item, put_new, put_clear (data structures: array, shiftreg, stack, queue)      </pre><pre>      save_var </pre>
+
      put_item, push_item, put_new, put_clear (data structures: array, shiftreg, stack, queue)       
 +
      save_var  
 +
</pre>
    
'''get+mod''':
 
'''get+mod''':
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
   
general format implementation func:
 
general format implementation func:
</blockquote> <pre>     function [ret, var] = get_fun(var, varargin) </pre><pre>        get_fun: the function name of your dedicated combined ''get+mod'' action </pre><pre>        var: the global variable </pre><pre>        varargin: any additional user input arguments </pre> <blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
+
</blockquote>  
 +
<pre>
 +
      function [ret, var] = get_fun(var, varargin)  
 +
        get_fun: the function name of your dedicated combined ''get+mod'' action  
 +
        var: the global variable  
 +
        varargin: any additional user input arguments  
 +
</pre>  
    +
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
specification table:
 
specification table:
</blockquote><pre>     getmod_fun(content,varargin)        </pre><pre>        content: constant, function or name of field for event structure </pre><pre>        varargin: any additional user input arguments  </pre>
+
</blockquote>
 +
<pre>
 +
      getmod_fun(content,varargin)         
 +
        content: constant, function or name of field for event structure  
 +
        varargin: any additional user input arguments   
 +
</pre>
    
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
examples:
 +
</blockquote>
 +
<pre>
 +
      pop_item (data structures: stack, queue)
 +
</pre>
   −
examples:
+
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
</blockquote><pre>      pop_item (data structures: stack, queue) </pre><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">NOTE: this is a special newly introduced operation since it combines both a <em>get</em>- and a <em>mod</em>-operation. This combined action is necessary to implement data structures with ''pop'' behaviour, where a ''get'' operation not only retrieves some content from the data structure, but also modifies the content and thus implicitly also involves a ''mod'' operation to update the corresponding global variables content.</blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px"> </blockquote>
+
NOTE: this is a special newly introduced operation since it combines both a <em>get</em>- and a <em>mod</em>-operation. This combined action is necessary to implement data structures with ''pop'' behaviour, where a ''get'' operation not only retrieves some content from the data structure, but also modifies the content and thus implicitly also involves a ''mod'' operation to update the corresponding global variables content.
 +
</blockquote>
    +
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px"> </blockquote>
 
'''Important:''' Function names should always be prefixed with either of the following options: 'get_', 'pop_', 'put_', 'push_', 'load_' or 'save_' in order to be recognized by BrainStream as a dedicated get/put action. The functions should be copied to the BrainStream $BRAINSTREAM_FOLDER/core/getput/ folder.
 
'''Important:''' Function names should always be prefixed with either of the following options: 'get_', 'pop_', 'put_', 'push_', 'load_' or 'save_' in order to be recognized by BrainStream as a dedicated get/put action. The functions should be copied to the BrainStream $BRAINSTREAM_FOLDER/core/getput/ folder.
    
<div id="ExamplesGetPut"></div>
 
<div id="ExamplesGetPut"></div>
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px"> </blockquote>
+
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px">
 +
</blockquote>
    
== Examples of custom-made get/put actions ==
 
== Examples of custom-made get/put actions ==

Navigation menu