[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default Path in Octave 4.2.1

From: Ian McCallion
Subject: Re: Default Path in Octave 4.2.1
Date: Mon, 12 Mar 2018 16:36:57 +0000

On Mon, 12 Mar 2018, 20:26 Raghu ram, Posimsetti (P.), <address@hidden> wrote:


I am trying to set default path while launching the tool, same code working with Octave 4.0.3 and not working 4.2.1

Modified code if file “octaverc”, path: Octave-4.2.1\share\octave\site\m\startup

Added code:

cdsid = lower(getenv('USERNAME'));

pathdir = strcat('C:\Users\',cdsid,'\Documents\OCTAVE');

if isdir(pathdir)






where cdsid is user name. after adding the above code default path not setting to expected one, instead default path is the folder where the Octave files are.

1.This cannot be the code that worked under 4.0.3 as 


is a syntax error. Did you mean

   cd (pathdir);

2. Also it is poor practice to use strcat to construct paths. Use fullfile instead as this deals automatically with the path separator.

      pathdir = fullfile('C:\Users', cdsid, 'Documents\OCTAVE');

3. Finally getenv('USERPROFILE') returns the user's home directory directly so 

       pathdir = fullfile(getenv('USERPROFILE'), 'Documents', 'OCTAVE');

would be the preferred way of doing what you want.

I don't know what your bug is but fix the above 3 points first and report back if still not working.

Cheers... Ian

reply via email to

[Prev in Thread] Current Thread [Next in Thread]