ispc

Tests whether the program runs on Windows.

Category: Environment and Settings > Platform and License

Syntax

tf = ispc

Returns true on Windows and false elsewhere.

Description

ispc is the usual way to handle differences such as the path separator, line endings or the command used to open a file. For portable paths prefer fullfile, which inserts the correct separator for the platform.

Output arguments

tf
Logical scalar.

Example

Branch on the operating system

if ispc
  disp('Windows')
elseif ismac
  disp('macOS')
else
  disp('Linux')
end
Output
Windows

See also

ismac isunix computer fullfile filesep