Re: fopen assistance requested.
- From: Michael Wild <themiwi.REMOVE.THIS@xxxxxxxxxxxxxxx>
- Date: Sat, 30 Jun 2007 00:18:54 +0200
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
.
- Follow-Ups:
- Re: fopen assistance requested.
- From: David Wilson
- Re: fopen assistance requested.
- References:
- fopen assistance requested.
- From: David Wilson
- fopen assistance requested.
- Prev by Date: Re: Any easy way to find lines of code missing semi-colons (;) at the end?
- Next by Date: Re: ploty - but a bar
- Previous by thread: Re: fopen assistance requested.
- Next by thread: Re: fopen assistance requested.
- Index(es):