klabhub / neurostim

Design and run visual neuroscience experiments using Matlab and the Psychophysics Toolbox.
MIT License
4 stars 3 forks source link

Modify storeInLog() to check for equality of NaNs. #196

Closed cnuahs closed 2 years ago

cnuahs commented 2 years ago

parameter.storeInLog() is intended to only log changes to a parameter's value. However, at present, assignment of NaN to a parameter can lead to excessive logging if the parameter's .value is already NaN.

This is because the current test all(v(:) == o.value(:)) is false if both v and o.value are NaN.

This can become a problem if a function string, evaluated every frame, evaluates to NaN leading to a NaN being logged every frame.

This change proposes to use isequaln(v(:),o.value(:)) in place of the existing all(v(:) == o.value(:)).

isequaln() was introduced in R2012a.