Re: How to use fpintf on Matlab for Mac.



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.
.



Relevant Pages

  • Re: export profile to Mac?
    ... thank you...is PC to Mac instructions the same if I am trying to transfer OE ... You can now insert the PC Zip/floppy disk. ... To do this quickly you can select all emails in each folder and simply ... TO EMAIL BOX: VIA IMAP MAIL SERVER ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: disk quotas
    ... the appropiate permissions on the TS home directory and redirected folder ... And how much free space do you have on your system disk and the F: ... so the redirection is actually taken place to the same ...
    (microsoft.public.windows.terminal_services)
  • Re: entourage dbase gone
    ... Also out of curiosity, what size is your hard disk, and how much free ... Once your data is completely backed up, consider reinstalling Mac OS ... automated solution, and do it manually, be sure to follow your backup ... folders in the Office 2004 identities folder. ...
    (comp.sys.mac.system)
  • Re: Installing Classic problem
    ... isn't recognised as being a system folder, ... The one exception appears to be the Startup Disk ... Preference Panel which will happily let me choose Mac OS X, ... died today when I tried to Repair the disk from the Disk Utility on the ...
    (comp.sys.mac.misc)
  • Re: B&W G3 Mac wont boot
    ... > Just today my daughter tried to start up her B&W G3 Mac and there was ... and the machine wouldn't boot. ... I do hear the hard disk ... need to move a few things from the old system folder (look in places ...
    (comp.sys.mac.system)