Can I get 'H:\' (not 'H:\\')from FULLFILE?
5 views (last 30 days)
Show older comments
In Matlab R2015b (Windows), FULLFILE('H:','\') returns 'H:\\' with a double-backslash, which raises bugs in our code. Older versions (e.g. R2010b) returned 'H:\' with the correct single-backslash. How do I get 'H:\' from FULLFILE?
0 Comments
Answers (2)
Jan
on 18 Feb 2016
This is a bug in fullfile. While this works correctly:
fullfile('H:\Folder\', filesep)
% 'H:\Folder\'
this is wrong:
fullfile('H:\', filesep)
% 'H:\\'
I'm using this replacement: FEX: JoinPath . You could store this in a folder, which is located before the toolboxes of Matlab in the PATH, and call it "fullfile.m". But I hesitate to shadow built-in functions.
0 Comments
Image Analyst
on 29 Apr 2016
This also occurs in R2016a.
Don't even use \ (backslash). Forward slash / works just fine in Windows, as well as Linux. Why are you still using backslash?
2 Comments
Image Analyst
on 29 Apr 2016
Perhaps it is a bug.

If you know your second path part is a single slash, then just hard code it
folder = 'H:/';
See Also
Categories
Find more on Filename Construction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!