Re: How to use fpintf on Matlab for Mac.
- From: Doug Schwarz <see@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Nov 2008 15:04:35 -0500
In article <ggnffb$orl$1@xxxxxxxxxxxxxxxxxx>,
"Edward " <contactmeoned_@xxxxxxxxxxxxx> wrote:
Hi everyone. I'm new to Matlab and programming in general. So please be
gentle.
One of my tutors has given me a demo file with this fprintf function, but it
was written for a pc system. So it references the drive address by letter. On
my mac, the drive has it's default name. I've tried swapping it around, but
it didn't work.
fid = ('Macintosh_HD:\FirCoef.asm','w') %I thought this would just open an an
asm file to the root (Mac HD)
for c = 1:N %Not sure what this does.
fprintf(fid,'coef_%d\tdc\t%1.8f\n',c,hdw(c)) %I thought this would write to
the asm file created above, format the data to be written from the wdm.
Please can someone help me by altering the code above and explaining what I
did wrong.
Thanks in Advance,
Ed
Are you using Mac OS X or the ancient Mac OS 9 (or earlier)?
Assuming you are using OS X, then you have a few
problems/misunderstandings:
1. You should be using unix style paths.
2. You should not be storing files in the root directory.
3. You should store files in your home directory (or a subdirectory).
4. The path to create the file called 'FirCoef.asm' in your home
directory is '~/FirCoef.asm'.
5. It is not necessary to know the name of your disk when you use ~ to
get to your home directory, but just for your information, the default
disk name is 'Macintosh HD' (with a space).
6. You can get to this disk (or any other disk) with
cd('/Volumes/<disk name>'), for example,
cd('/Volumes/Macintosh HD')
7. The default disk can also be referred to as simply '/', e.g.,
cd /
So, the code to open your file is
fid = fopen('~/FirCoef.asm','w');
Better would be to create a directory (folder) called 'matlab' in your
home directory:
fid = fopen('~/matlab/FirCoef.asm','w');
or to put the matlab folder in your Documents folder:
fid = fopen('~/Documents/matlab/FirCoef.asm','w');
--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
.
- References:
- How to use fpintf on Matlab for Mac.
- From: Edward
- How to use fpintf on Matlab for Mac.
- Prev by Date: Re: getting a list
- Next by Date: Advancing smaples by rational number.
- Previous by thread: Re: How to use fpintf on Matlab for Mac.
- Next by thread: creating a list
- Index(es):
Relevant Pages
|