Skip to content

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

Open
chrisjcox wants to merge 1 commit intoct6502:mainfrom
chrisjcox:bug-report
Open

Fix bug in chisquare_inv.m related to vers variable parsing in MATLAB versions >= 10#9
chrisjcox wants to merge 1 commit intoct6502:mainfrom
chrisjcox:bug-report

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