Boolean Value in Variable Set for Release 0.7

's Avatar

ziye.xu

13 Jan, 2017 07:24 PM

Hi Chris,

We notice that if a variable set is loaded, the boolean value can change from "True/False" to numeric numbers 0/1 in the variable display window. It would be nice if the boolean value can be consistent.

Thanks,
Ziye

  1. Support Staff 1 Posted by Christopher Sta... on 18 Jan, 2017 02:46 PM

    Christopher Stawarz's Avatar

    Hi Ziye,

    I am not able to reproduce the problem you describe. Can you send me a copy of the variable set XML file that you're using? You can find the file in

    $HOME/Documents/MWorks/Experiment Storage/_path_to_your_experiment/Saved Variables
    

    Also, what is the name of the variable whose displayed value is changing?

    Thanks,
    Chris

  2. 2 Posted by Ziye Xu on 18 Jan, 2017 06:55 PM

    Ziye Xu's Avatar

    Hi Chris,

    Both the experiment and variable are attached.

    Thanks,

    Ziye

  3. Support Staff 3 Posted by Christopher Sta... on 18 Jan, 2017 08:22 PM

    Christopher Stawarz's Avatar

    Hi Ziye,

    Thanks for the files. Can you tell me the name of a variable whose value you've seen switch from true/false to 0/1?

    Thanks,
    Chris

  4. 4 Posted by Ziye Xu on 18 Jan, 2017 08:58 PM

    Ziye Xu's Avatar

    For example, "doOnlyMaxDiff" is defined as Boolean in experiment file but in the saved variable xml, it's integer. I think that's why it showed up as 0/1 after loading. It's not clear to me why it was saved as different data type. When I tried to make it as True/False in variable display window, it would still be numeric. It seems the only way to do it is to change the variable set xml file in text editor.

  5. Support Staff 5 Posted by Christopher Sta... on 19 Jan, 2017 03:56 PM

    Christopher Stawarz's Avatar

    Hi Ziye,

    Thanks for the additional info.

    For example, "doOnlyMaxDiff" is defined as Boolean in experiment file but in the saved variable xml, it's integer. I think that's why it showed up as 0/1 after loading.

    Yes, that's correct.

    When I tried to make it as True/False in variable display window, it would still be numeric.

    More specifically, if you try to change 0 to false or 1 to true, the value will still be numeric. However, if you change 0 to true or 1 to false, then the value will become boolean.

    The reason for this is that, before assigning a newly-entered value to a variable, the variables window first checks whether the new value is equal to the old value. If it is, then no assignment is made. In MWorks' view, true is equal to 1 (and false to 0), so attempting to replace the former with the latter results in no change. However, if you first change 1 to false, and then change false to true, the final value will be boolean.

    I see how this behavior can be confusing and/or annoying. It should be pretty straightforward to fix. I'll add it to my to-do list.

    Cheers,
    Chris

  6. Christopher Stawarz closed this discussion on 31 Jan, 2017 03:37 PM.

  7. Support Staff 6 Posted by Christopher Sta... on 11 Sep, 2017 03:00 PM

    Christopher Stawarz's Avatar

    Hi Ziye,

    This issue is fixed in the current MWorks nightly build. In the variables window, you can now change 0 to true or 1 to false, and the type change will persist.

    Cheers,
    Chris

  8. Christopher Stawarz closed this discussion on 18 Sep, 2017 01:58 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

Recent Discussions

17 May, 2022 02:12 PM
16 May, 2022 03:12 PM
04 May, 2022 06:02 PM
03 May, 2022 01:30 PM
02 May, 2022 10:47 PM