Re: fopen assistance requested.



David Wilson wrote:
Hello,

I want to use fopen to:

1. Open a file that doesn't exist, therefore creating it,
2. Open this file in a different directory than the working
dierectory.

Example:
fopen('output01.txt') and I want the path to be
c:\ ... \work\results\currentproject\output.txt

My question is "How do I declare what directory I want to open the
new file in?" that is the syntax I have found for fopen doesn't
include the path.

thank you in advance for your help.
David
P.S. I am using the Windows XP OS with Matlab 7.0.1.15 (R14)

fname = 'c:\ ... \work\results\currentproject\output.txt';
fid = fopen(fname,'wt');

% do something

fclose(fid);


if you need to construct the file name, have a look at the FULLFILE and FILESEP functions (you want to be platform independent, do you?)

michael
.