Textscan blanks disappears from file

조회 수: 4 (최근 30일)
Valentino
Valentino 2018년 3월 1일
답변: Valentino 2018년 3월 1일
Hi guys,
when i read my text file which looks like this:
0.0000 0.3826004
0.0100 0.395591
0.0199 0.4085815
the blanks in the front get lost so my output looks like this:
0.0100 0.395591
my code is simple:
fileID=fopen(fullfile(pathname,files));
formatSpec = '%s';
input = textscan(fileID,formatSpec,'delimiter','\n');
fclose(fileID);
i want to handle it as strings because the shape of the file is arbitrary thanks

채택된 답변

Valentino
Valentino 2018년 3월 1일
Had to add
input = textscan(fileID,formatSpec,'delimiter','\n','whitespace','');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by