Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
directory separator

Subject: directory separator

From: Nicholas Pedersen

Date: 15 May, 2000 14:19:16

Message: 1 of 6

Hi all

I'm writing a matlab-function that I need to run on both Win-PC's and
UNIX-stations.

My question is:
Is there a matlab-variable, say DIRSEPARATOR, describing the directory
separator ('\' on Win-PC's and '/' on UNIX)?

This would allow me to specify a path something like
strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt') which would
act as
'\matlab\datafile.txt' on PC's and as
'/matlab/datafile.txt' on UNIX-systems.

Any help is appreciated


Nicholas Pedersen

-----------------------------------------------------------
Nicholas Pedersen E-mail np@et.dtu.dk
Dept. of Energy Engineering http://www.afm.dtu.dk/staff/np/
Fluid Mechanics Section Phone (+45) 4525 4326
Technical University of Denmark Fax (+45) 4593 0663
------------------------------------------------------------

Subject: directory separator

From: Michael Robbins

Date: 15 May, 2000 05:23:38

Message: 2 of 6

% BTW,
% strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt')
% is the same as
% [DIRSEPARATOR 'matlab' DIRSEPARATOR 'datafile.txt']
function z=dirseparator

if isunix
z='/';
else
z='\';
end;

Michael Robbins, CFA
Director, Proprietary Trading
Debt Capital Markets
Canadian Imperial Bank of Commerce, World Markets
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

Subject: directory separator

From: Amanda Galtman

Date: 15 May, 2000 08:27:45

Message: 3 of 6

Hi Nicholas,

Check out FILESEP and FULLFILE.

Best wishes,
Amanda


Nicholas Pedersen <np@et.dtu.dk> wrote in message
news:391FEB44.22165E68@et.dtu.dk...
> Hi all
>
> I'm writing a matlab-function that I need to run on both Win-PC's and
> UNIX-stations.
>
> My question is:
> Is there a matlab-variable, say DIRSEPARATOR, describing the directory
> separator ('\' on Win-PC's and '/' on UNIX)?
>
> This would allow me to specify a path something like
> strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt') which would
> act as
> '\matlab\datafile.txt' on PC's and as
> '/matlab/datafile.txt' on UNIX-systems.
>
> Any help is appreciated
>
>
> Nicholas Pedersen
>
> -----------------------------------------------------------
> Nicholas Pedersen E-mail np@et.dtu.dk
> Dept. of Energy Engineering http://www.afm.dtu.dk/staff/np/
> Fluid Mechanics Section Phone (+45) 4525 4326
> Technical University of Denmark Fax (+45) 4593 0663
> ------------------------------------------------------------
>
>

Subject: directory separator

From: Herbert Ramoser

Date: 15 May, 2000 14:28:47

Message: 4 of 6

Try filesep

Hope this helps,

  Herbert

Nicholas Pedersen wrote:
>
> Hi all
>
> I'm writing a matlab-function that I need to run on both Win-PC's and
> UNIX-stations.
>
> My question is:
> Is there a matlab-variable, say DIRSEPARATOR, describing the directory
> separator ('\' on Win-PC's and '/' on UNIX)?
>
> This would allow me to specify a path something like
> strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt') which would
> act as
> '\matlab\datafile.txt' on PC's and as
> '/matlab/datafile.txt' on UNIX-systems.
>
> Any help is appreciated
>
> Nicholas Pedersen
>
> -----------------------------------------------------------
> Nicholas Pedersen E-mail np@et.dtu.dk
> Dept. of Energy Engineering http://www.afm.dtu.dk/staff/np/
> Fluid Mechanics Section Phone (+45) 4525 4326
> Technical University of Denmark Fax (+45) 4593 0663
> ------------------------------------------------------------

Subject: directory separator

From: lg@kt.dtu.dk (Lars Gregersen)

Date: 15 May, 2000 12:42:58

Message: 5 of 6

On Mon, 15 May 2000 14:19:16 +0200, Nicholas Pedersen <np@et.dtu.dk>
wrote:

>Hi all
>
>I'm writing a matlab-function that I need to run on both Win-PC's and
>UNIX-stations.
>
>My question is:
>Is there a matlab-variable, say DIRSEPARATOR, describing the directory
>separator ('\' on Win-PC's and '/' on UNIX)?

Yes, use filesep

>This would allow me to specify a path something like
>strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt') which would

No, use fullfile instead

  Lars

------------------------------
Lars Gregersen (lg@kt.dtu.dk)
http://www.gbar.dtu.dk/~matlg

Check out my matlab toolboxes at:
http://members.xoom.com/gregersenweb/matlab/

Subject: directory separator

From: michaels@ece.ece.arizona.edu (Michael Schweisguth)

Date: 15 May, 2000 15:56:25

Message: 6 of 6

there is also a function called "fullfile" which does
want you want.

Nicholas Pedersen (np@et.dtu.dk) wrote:
: Hi all

: I'm writing a matlab-function that I need to run on both Win-PC's and
: UNIX-stations.

: My question is:
: Is there a matlab-variable, say DIRSEPARATOR, describing the directory
: separator ('\' on Win-PC's and '/' on UNIX)?

: This would allow me to specify a path something like
: strcat(DIRSEPARATOR,'matlab',DIRSEPARATOR,'datafile.txt') which would
: act as
: '\matlab\datafile.txt' on PC's and as
: '/matlab/datafile.txt' on UNIX-systems.

: Any help is appreciated


: Nicholas Pedersen

: -----------------------------------------------------------
: Nicholas Pedersen E-mail np@et.dtu.dk
: Dept. of Energy Engineering http://www.afm.dtu.dk/staff/np/
: Fluid Mechanics Section Phone (+45) 4525 4326
: Technical University of Denmark Fax (+45) 4593 0663
: ------------------------------------------------------------

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us