addpath question

I have this code running 2010b 32 and 64 bit versions on two machines respectively.
pax300_top_level = cd;
eval(['addpath ',pax300_top_level,'/Ambient'])
It works perfectly on 64bit but I get the following error running it on my 32bit work pc.
Warning: Name is nonexistent or not a directory: C:\Documents. > In path at 110 In addpath at 87 Warning: Name is nonexistent or not a directory: and. > In path at 110 In addpath at 87 Warning: Name is nonexistent or not a directory: Settings\WSUadm\My. > In path at 110 In addpath at 87 Warning: Name is nonexistent or not a directory: Documents\Remus\CMAPS\c_mapss_2p0\Ambient. > In path at 110 In addpath at 87
Note:Its not a '/' or '\' issue.
Thanks, Remus

Respuestas (3)

Fangjun Jiang
Fangjun Jiang el 14 de Sept. de 2011

1 voto

Maybe it's because there is a white space in the folder name, such as 'My Documents'?
By the way, why do you use eval()? You can use the addpath() function directly. Please try that.
Grzegorz Knor
Grzegorz Knor el 14 de Sept. de 2011

1 voto

Try in this way:
eval(['addpath(''',pax300_top_level,'/Ambient'')'])
It should work on two systems.

5 comentarios

Grzegorz Knor
Grzegorz Knor el 14 de Sept. de 2011
Fangjun Jiang suggestion's to not use the eval command is a better solution.
Remus
Remus el 14 de Sept. de 2011
It's not my code and I dont't want to make any changes
Kaustubha Govind
Kaustubha Govind el 14 de Sept. de 2011
Are you working in a directory with spaces in its path? Try moving to one that doesn't have spaces?
Fangjun Jiang
Fangjun Jiang el 14 de Sept. de 2011
+1. I think you found the root cause of the problem. Using the command format instead of the function format of addpath, the white space in the pax300_top_level string will cause the problem. I was not 100% sure before reading your answer.
Walter Roberson
Walter Roberson el 14 de Sept. de 2011
If you are not willing to make changes to the (broken) code, then your only alternative is to arrange things so that you are not in a directory that has a space in the name. If that, too, is something you do not want to do, then.... ummm, I guess in that case you would have to hand the problem back to your supervisor for resolution.

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 14 de Sept. de 2011

1 voto

Don't use eval if it can be avoided. Just use
addpath([pax300_top_level, '/Ambient'])
The 32 bit machine happens to have a space in the current directory name, so a space is included in the string you are generating. When you eval() that, the space is taken as indicating the end of the argument. That's the sort of problem that eval() can cause.

Categorías

Más información sobre Search Path en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Sept. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by