How to check MATLAB version and choose compatible functions?

109 visualizaciones (últimos 30 días)
sgtitle is available in MATLAB R2019b but not in R2018a
suptitle is available in MATLAB R2018a but not in R2019b.
If I'm distributing, how can I check the release to use the compatible function?

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 11 de Nov. de 2019
Editada: Stefanie Schwarz el 14 de Sept. de 2023

Más respuestas (2)

Oli Fairfax
Oli Fairfax el 23 de Ag. de 2021
You can also use the following to keep it on one line:
version('-release')
ans = '2021a'

Abdul Basith Ashraf
Abdul Basith Ashraf el 11 de Nov. de 2019
v= ver('MATLAB');
if v.Release=="(R2018a)"
%Code
elseif v.Release=="(R2019b)"
%Code
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by