Program made for matlab on windows doesn't work on linux. Path problem.

I am trying to use a program on matlab for linux, but it was made for matlab on windows.
The problem is that it tries to work with windows paths over linux.
Warning: Name is nonexistent or not a directory: /ADVISOR2002/advisor.m\saved_vehicles.
As you can see the backslash is the problem.
Any suggestion?
Regards,
Poncho

回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 9 月 12 日

0 投票

Edit the program and find where it uses \ as the separator and replace it with / . The program will then be usable on both systems. To say that more explicitly: MS Windows is able to use / as the directory separator as well as the traditional Windows \
In future you can code the separator character using the result of the pathsep() function call, or you can use the fullfile() routine which will automatically use the traditional separator for the system being run on.

5 件のコメント

poncho
poncho 2011 年 9 月 13 日
Hi,
I know this is the obvious solution, but it is a big program, not made by me, so it would be a very hard task to do that.
My workaround has been to run matlab using wine, and it works, but I would prefer to run it without wine.
Thanks !!
Poncho
Walter Roberson
Walter Roberson 2011 年 9 月 13 日
Depending on what is going on, you may be able to rescue the situation using symbolic links. Perhaps something like
cd /ADVISOR2002
[[ ! -d saved_vehicles ]] && mkdir saved_vehicles
ln -s saved_vehicles advisor.m\\saved_vehicles
Jan
Jan 2011 年 9 月 13 日
@Walter: PATHSEP separates the folders in the PATH string. I assume, you meant FILESEP.
Fangjun Jiang
Fangjun Jiang 2011 年 9 月 13 日
@Walter, I think you meant to use filesep(), not pathsep()
Walter Roberson
Walter Roberson 2011 年 9 月 13 日
<rant>
Dang nomenclature! Those '/' or '\' characters are called path separators in POSIX! The string as a whole forms a "file path" in POSIX. TMW should have called it pathifs not pathsep !
</rant>

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeEnvironment and Settings についてさらに検索

質問済み:

2011 年 9 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by