Digital codes

Christopher Stawarz's Avatar

Christopher Stawarz

17 Jun, 2021 08:37 PM

Hi Chris -

I have another question for you regarding format/syntax of %include files.

I'm trying to generate an ecodes.mwel that contains all the digital event codes for different trial events that we can then use in any experiment using %include.

The way I was thinking about it, this ecodes.mwel (attached) would have the values for different codes that would become accessible to my example1.mwel after using %include. And then, we can use the vpixx functionality you wrote to send the"event codes" followed by the "value codes" to the vpixx monitor. For example:

vpixx_send_blackrock_sync_word (e_fixation_width) //EVENT CODE:
vpixx_send_blackrock_sync_word (v_fixation_width) //VALUE CODE

This doesn't work - and when I %include ecodes, I get errors related to unknown variables, as follows:

00:00:04: ERROR: Unknown variable: e_fixation_width

3 questions please:

(1) Could you please guide me on how to define all the variables in the ecodes.mwel correctly to eliminate this error? Do I simply have to set all the event codes to zero at the beginning of ecodes.mwel? For example:

var e_fixation_width = 0

(2) How do we define variables without having them show up in the variables window when running MWorks?

(3) Am I right that we could use the vpixx_send_blackrock_sync_word to send event codes and value codes? For example:

vpixx_send_blackrock_sync_word (5001) //sending event code for fixation width
vpixx_send_blackrock_sync_word (2010) //sending value for fixation window of 10 (ie. 10+2000 offset so that we don't have negative codes)

Thank you!
Yasmine

  1. Support Staff 1 Posted by Christopher Sta... on 17 Jun, 2021 08:50 PM

    Christopher Stawarz's Avatar

    Hi Yasmine,

    (1) Could you please guide me on how to define all the variables in the ecodes.mwel correctly to eliminate this error?

    You’re just missing the "var" at the beginning of each declaration. That is, replace

    e_fixation_width = 5001
    

    with

    var e_fixation_width = 5001
    

    But that said:

    (2) How do we define variables without having them show up in the variables window when running MWorks?

    It seems like it would be more appropriate to define these constants with expression macros, rather than as variables. For example:

    %define e_fixation_width = 5001
    

    You can use the names of expression macros like variables and still write stuff like

    vpixx_send_blackrock_sync_word (e_fixation_width)
    

    However, they aren’t variables, so they won’t show up in the variables window, and their values can’t be changed.

    If, for some reason, you really do want to define them as variables, it isn’t possible to exclude them from the variables window. However, you can create one or more groups (aka folders) for the variables that you do want in the variables window, and then expand just those groups. For example:

    group 'Useful Variables' {
        var x = 1
        var y = 2
    }
    
    // Not useful variables
    var z = 3
    

    (3) Am I right that we could use the vpixx_send_blackrock_sync_word to send event codes and value codes?

    Yes, as long as all the codes are integers between 0 and 65535.

    Cheers,
    Chris

  2. 2 Posted by Yasmine El-Sham... on 17 Jun, 2021 10:03 PM

    Yasmine El-Shamayleh's Avatar

    Perfect! Thanks Chris!
    Yasmine

  3. Christopher Stawarz closed this discussion on 13 Jul, 2021 03:11 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac