Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

specify file path in matlab Mac OS X

362 views
Skip to first unread message

Gaurav

unread,
Jan 28, 2011, 11:33:04 AM1/28/11
to
HOW do you specify file-name in Matlab in OS X Snow Leopard

for e.g. I can write a command like
[a b]= textread('F: \experimentalresults\sample1.txt',......) in windows and its fine.

How do I write while using a Mac.....
the approach [a b] = textread('Users/username/experimentalresults/sample.txt',....) is not wroking !!

*************
I am using MBP intel core, OS X (version 10.6.6) and Matlab2010_b.

Jos (10584)

unread,
Jan 28, 2011, 11:46:03 AM1/28/11
to
"Gaurav " <g...@celos.ac.in> wrote in message <ihur40$941$1...@fred.mathworks.com>...

What is the error you get? Are you sure you specify the correct path, and/or the correct format identifiers?
It is working perfectly fine here (10.6.6 + 2010b)

Jos

Think blue, count two.

unread,
Jan 28, 2011, 11:54:25 AM1/28/11
to


textread('/Users/username/experimentalresults/sample.txt',....)

When there is no leading '/', names are interpreted as being relative to
the current directory.

Gaurav

unread,
Jan 28, 2011, 12:18:04 PM1/28/11
to
"Think blue, count two." <robe...@hushmail.com> wrote in message <6xC0p.452$Pi6...@newsfe01.iad>...

hi again
i m getting ??? Error using ==> textread at 167
File not found.

Yes i used leading '/', still the error message

identifiers and rest syntax is fine, its working in windows.

Think blue, count two.

unread,
Jan 28, 2011, 12:20:52 PM1/28/11
to
On 28/01/11 11:18 AM, Gaurav wrote:
> "Think blue, count two." <robe...@hushmail.com> wrote in message

>> textread('/Users/username/experimentalresults/sample.txt',....)

> hi again i m getting ??? Error using ==> textread at 167
> File not found.

You know that where you have put username, that you have to put the
actual username? e.g.,

'/Users/roberson/experimentalresults/sample.txt'

Gaurav

unread,
Jan 28, 2011, 12:38:04 PM1/28/11
to
This exactly what i have written::
[a b]= textread('\Users\gauravs\experimentalresults\44.txt','%f %f', 'headerlines',0);

i even changed the slashes but didnt work out

Think blue, count two.

unread,
Jan 28, 2011, 1:02:06 PM1/28/11
to

Mac OS X *never* uses \ as a directory separator.

/Users/gauravs/experimentalresults/44.txt

is plausible.

Are the results in a folder that appears on your desktop? If so then it
would be

/Users/gauravs/Desktop/experimentalresults/44.txt

I suggest that you enter Matlab, and at the command prompt, type

!find /Users/gauravs -name 44.txt -print

Notice the exclamation mark at the beginning of the command.

If nothing shows up then the files are not under that account. If
something shows up, it will have the exact path you need to use to open it.

0 new messages