I am running MATLAB on Linux and Windows XP. My files are synchronized between all the computers that I use, but due to differences in the directory structure between Linux and Windows, I have to have separate import and export lines for different operating systems. Right now I'm just commenting out a line for the wrong OS, but I'm wondering if it is possible to write something like:
if OS == Windows
datafile = csvread('C:\Documents and Settings\Me\MyPath\inputfile.csv');
else
datafile = csvread('/home/Me/MyPath/inputfile.csv');
end
This is also a more general question that applies when you need to execute system commands from MATLAB with system('command').
source
share