detectOS

版本 1.1.1 (4.5 KB) 作者: Jorg Woehl
Name and version number of the operating system
191.0 次下载
更新时间 2024/5/13

View detectOS on File Exchange

detectOS

detectOS returns the name and version number of the operating system.

Purpose

For the development of cross-platform apps in MATLAB, it is useful to know the operating system (OS) on which MATLAB is running. For example, this allows to select native fonts and font sizes (see getOSfont) or to fine-tune the layout and design of graphical user interface elements. detectOS returns the name and version number of the underlying OS for a wide range of platforms and OS versions.

Usage

OS = detectOS returns the name of the operating system as a lowercase character vector, such as 'windows', 'macos' (which includes OS X), 'solaris', 'aix', 'ubuntu', 'centos', and many other Unix/Linux distributions. It is thus much more fine-grained than MATLAB's built-in ispc / ismac / isunix and computer functions. If the OS cannot be determined, an error is thrown.

[OS, OSVersion] = detectOS also returns the OS version number as a numeric row vector. For example, Windows 7 SP1 (version 6.1.7601) is reported as OS = 'windows' and OSVersion = [6, 1, 7601]. If the OS version cannot be determined, a warning is issued and the empty numeric array is returned.

For a list of Windows releases, see https://en.wikipedia.org/wiki/Ver_(command).

For a list of macOS releases, see https://support.apple.com/en-us/HT201260.

Requirements

detectOS is compatible with MATLAB R2016b and later releases (version 1.0 is compatible with R2013a and later releases). It was tested on the following operating systems (64-bit, unless otherwise stated) and should run on a wide variety of other Unix/Linux distributions without any modification:

  • Windows 10 (10.0.10586)
  • Windows 8.1 Update 1 (6.3.9600)
  • Windows 7 (6.1.7601)
  • Windows 7 (6.1.7601), 32-bit
  • Windows XP Pro SP3 (5.1.2600),32-bit
  • macOS Sonoma (14.4.1)
  • macOS Ventura (13.0.1)
  • macOS Big Sur (11.2.3)
  • macOS Catalina (10.15.7)
  • macOS Sierra (10.12.1)
  • OS X El Capitan (10.11.6)
  • Ubuntu 16.04 LTS
  • Ubuntu 15.10
  • Ubuntu 14.04 LTS
  • CentOS 7
  • CentOS 6.8 (Final)

Motivation

Another great tool returning information about the CPU and operating system is CPU Info. Unfortunately, CPU Info does not differentiate between Unix/Linux distributions, and does not return sensible information about the OS version in these cases. Adding this capability was the main motivation for developing detectOS.

Feedback

Please let me know if you have tested detectOS on other operating systems. Thank you for any feedback or suggestions for improvement!

引用格式

Jorg Woehl (2024). detectOS (https://github.com/JorgWoehl/detectOS/releases/tag/v1.1.1), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2013a
与 R2016b 及更高版本兼容
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

无法下载基于 GitHub 默认分支的版本

版本 已发布 发行说明
1.1.1

See release notes for this release on GitHub: https://github.com/JorgWoehl/detectOS/releases/tag/v1.1.1

1.1.0.1

See release notes for this release on GitHub: https://github.com/JorgWoehl/detectOS/releases/tag/v1.1.0.1

1.1

See release notes for this release on GitHub: https://github.com/JorgWoehl/detectOS/releases/tag/v1.1

1.0.0.0

Small change in file description
Added macOS Sierra to tested platforms
Added space
Minor change to image.
Teaked file description
Added image
Updated description and image
Updated file description
Added space
Updated picture
Updated comments and description

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库