Skip to content
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

Bug in arMyStr2Sym connected to MATLAB version #165

Open
laasfeld opened this issue Apr 30, 2021 · 3 comments
Open

Bug in arMyStr2Sym connected to MATLAB version #165

laasfeld opened this issue Apr 30, 2021 · 3 comments

Comments

@laasfeld
Copy link

laasfeld commented Apr 30, 2021

When calling arMyStr2Sym the function call fails. The problem seems to be on line 17

if(str2double(matver.Version) >= 9.4)

It branches into the else caluse and causes further problems with symbolic conversions for Matlab version 2021a as matver.Version value is '9.10' and str2double(matver.Version) equals 9.1, which of course is smaller than 9.4.
Possible solution is using verLessThan function (for example "if(~verLessThan('matlab', '9.4'))" ) or something similar.
verLessThan is added in R2007a so there should be sufficient backwards compatibility.

@laasfeld
Copy link
Author

laasfeld commented May 1, 2021

Similar problem in arCcode line 113.

adrianhauber added a commit that referenced this issue May 3, 2021
matver.Version 9.10 is converted to 9.1 in str2double. Replace by verLessThan command as suggested by laasfeld in issue #165
@adrianhauber
Copy link
Member

Thanks for pointing this out, should be fixed now!

@adrianhauber
Copy link
Member

adrianhauber commented May 4, 2021

It seems this issue extends further than I originally thought. Multiple functions, including arCompileAll, arPlotMulti, arLink, arPlotX, arPlotY, arPlotV, arSym, arSubs, arSubsRepeated, arPlot2, arLoadData, arLoadModel, arReport, arMiniReport, check the Matlab version using ver('matlab') and convert to result to double.

I implemented an ad hoc solution by replacing all occurrences of ver('matlab') with arVer, which has the same output as ver('matlab') but changing the Version field to 9.91 for 9.10.

As this issue will persist for all future 9.x versions, it will become increasingly difficult to keep track of version specific behaviour. I propose to use verLessThan as suggested by @laasfeld instead, which is also the recommended way of implementing version specific behaviour by MathWorks.

@adrianhauber adrianhauber reopened this May 4, 2021
adrianhauber added a commit that referenced this issue May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants