Skip to content

Fix bug in chisquare_inv.m related to vers variable parsing in MATLAB versions >= 10 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chrisjcox
Copy link

In the wave_matlab/chisquare_inv.m script, the vers variable (used to determine the MATLAB version) has a bug: it strips only the first character of the version string to retain as a compatibility check. This results in an incorrect encoding where the vers variable only captures the most significant version digit for MATLAB versions 10 and above.

For example, the current MATLAB version R2024b (version 24) would be parsed as 2. Consequently, in the subsequent if statement, the depreciated fmin function is selected and the script crashes. For MATLAB versions < 100, 10-59 would be affected.

Solution:

Option 1 (preserving backward compatibility): Using functionalities that would be available in legacy MATLAB versions, could update as vers = str2double(datestr(version('-date'), 'yyyy')) to check the release year. This would ensure compatibility with older versions, preserving the intended functionality for fmin.

Option 2 (final solution): However, since fmin has been depreciated for a long time, I opted to remove vers and all its dependencies. The code would now always use fminbnd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant