Fullfile function gives me a false reading with the slash symbol
5 次查看(过去 30 天)
显示 更早的评论
fileToRead = fullfile('C:\Users\thomas\Files\' CCC '.csv');
CCC is a string file with CCC='Tax'
I get the following:
C:\Users\thomas\Files\Tax\.csv
but I want the following
C:\Users\thomas\Files\Tax.csv
1 个评论
采纳的回答
更多回答(1 个)
darova
2020-3-29
Try this
Or you can remove slash symbol
fileToRead(end-5) = [];
1 个评论
Stephen23
2020-3-30
编辑:Stephen23
2020-3-30
There is absolutely no point in doing this:
This answer confuses two different ways of creating the full filename: string concatenation OR using fullfile. It makes absolutely NO sense to combine the two as shown in this answer, which has all of the disadvantages of string concatenation (no automatic handling of the slash/backslash) and only one input to fullfile (thus making it totally superfluous anyway).
I strongly recommend that users read about fullfile before blindly copying this answer.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pulsed Waveforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!