folder path difference in 'Windows' and 'Linux' system
29 ビュー (過去 30 日間)
古いコメントを表示
I found that the folder path expression is different between 'windows' and 'linux' system.
for window system, it use '\' between folders and sub-folders,
in linux system, it uses '/'.
this make some error when I translate the matlab code from windows to linux system.
is this an inherent feature of Matlab? or is there anyway to solve this problem?
Thansk!
Yu
0 件のコメント
採用された回答
Rik
2019 年 1 月 13 日
5 件のコメント
Stephen23
2019 年 1 月 14 日
"I have code such as tmp=[pwd,'\test.mat'], but when I translate these code into Linux it reports error"
This is exactly why you should avoid hard-coding file separators and avoid using string concatenation. It is much better to use fullfile, which automatically takes care of this.
This difference in separators has nothing to do with MATLAB, it is determined by the OS. Other OSs use other file separators too:
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!