MATLAB: How to use a file from a different directory

different directoryfilefullfilepath

Hello,
i have developed a program and it works correctly ,and now i want to make it as a function so i need as input a directory(directoryname) and inside the function i want to get the file c.ini wich is in the directoryname
function B(directoryname) % the function B is why i am trying to program now
N = inifile(directoryname\c.ini,90) %infile is a one of my function wich needs as input the file c.ini
Thank you

Best Answer

Use fullfile to build the full filename:
function B(dirName)
N = inifile(fullfile(dirName,'c.ini'),90)
...
end
Related Question