Although Mac OS and Linux are based on Unix system, they have different directory path which need to be determined for cross-platform.
There are ways to tell which operating system you are running on in MATLAB.
isunix
This command tell whether you are running on a unix system or not. Both Mac OS and Linux system return is ‘1’.
ispc
This command tell whether you are running on a Windows system or not. Both Mac OS and Linux system return is ‘0’ and a Windows system return ‘1’.
computer
This command returns string containing type of computer on which MATLAB is executing. Of course, returns are different for each Mac OS and Linux system.
More useful information can be found by typing
help computer
on MATLAB console.