dealing with and / (windows vs. unix) for path definition.
Hi everybody,
Simple question, let’s say I’m using mac osx and some colleagues use windows… and I have to share a matlab script. Problem, this script needs to look in folder to load data files or print figures:
load ./data/data.mat
plot(data(:,1),data(:,2))
print -dpdf ./graph/figure.pdf
this is how it is written on unix system, but on windows I have to replace all the / by
load .datadata.mat
…
Is there a way to deal with that or the only way to make it works on both systems is to add a conditional statement like
if isunix
load ./data/data.mat
else
load .datadata.mat
end
thanks for any help,
cheers
PieterHi everybody,
Simple question, let’s say I’m using mac osx and some colleagues use windows… and I have to share a matlab script. Problem, this script needs to look in folder to load data files or print figures:
load ./data/data.mat
plot(data(:,1),data(:,2))
print -dpdf ./graph/figure.pdf
this is how it is written on unix system, but on windows I have to replace all the / by
load .datadata.mat
…
Is there a way to deal with that or the only way to make it works on both systems is to add a conditional statement like
if isunix
load ./data/data.mat
else
load .datadata.mat
end
thanks for any help,
cheers
Pieter Hi everybody,
Simple question, let’s say I’m using mac osx and some colleagues use windows… and I have to share a matlab script. Problem, this script needs to look in folder to load data files or print figures:
load ./data/data.mat
plot(data(:,1),data(:,2))
print -dpdf ./graph/figure.pdf
this is how it is written on unix system, but on windows I have to replace all the / by
load .datadata.mat
…
Is there a way to deal with that or the only way to make it works on both systems is to add a conditional statement like
if isunix
load ./data/data.mat
else
load .datadata.mat
end
thanks for any help,
cheers
Pieter unix windows path dir MATLAB Answers — New Questions