MATLAB Answers

How Can I Get the Windows Version Number in a Script?

11 views (last 30 days)
In a MATLAB script, how can I retrieve the computer's version of Windows?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Feb 2018
In order to get the Windows version, please execute the following line of code in the MATLAB Command Window:
>> [~, WindowsVersion] = system('ver')
The above command calls the ‘system’ MATLAB function.  This MATLAB function tells the operating system to execute the command ‘ver’, which outputs the version of Windows on the computer.  For more information about the ‘system’ MATLAB function, please refer to the following link:


Sign in to comment.

More Answers (1)

Petorr on 13 Dec 2019
Just a note, system('ver') can be slow to return (~0.5 seconds in my PC), adding to latency if used in GUI callbacks, etc.


Sign in to comment.


No tags entered yet.




Translated by