Boolean Value in Variable Set for Release 0.7

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

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

Hi Chris,

Both the experiment and variable are attached.

Thanks,

Ziye

Attachments:

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

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.

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

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