how can I count/read an Enter as one character?
Ältere Kommentare anzeigen
so here's the problem, i have a text file named sampletext.txt containing:
Hello Word
1 2 3 4 5 6
,I used the code
fid = fopen('sampletext.txt');
A = char(fread(fid,inf)).';
L = length(A)
the expected output is 22 but is outputs 23, it counts enter as 2 character. please help. :)
thankyou!
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 9 Mär. 2014
0 Stimmen
Why not simply use fgetl() if you want to read line by line?
2 Kommentare
Jan
am 9 Mär. 2014
@Image Analyst: Jaybee did not say, that the file should be read line by line.
Image Analyst
am 10 Mär. 2014
No but I just offered as a possibility in case he wants to and to not have to worry about 10s and 13s.
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!