Fullfile function gives me a false reading with the slash symbol
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Akzeptierte Antwort
Weitere Antworten (1)
darova
am 29 Mär. 2020
Try this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/280501/image.png)
Or you can remove slash symbol
fileToRead(end-5) = [];
1 Kommentar
Stephen23
am 30 Mär. 2020
Bearbeitet: Stephen23
am 30 Mär. 2020
There is absolutely no point in doing this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/280539/image.png)
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.
Siehe auch
Kategorien
Mehr zu File Name Construction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!