import text file from different location, multiple delimiter

조회 수: 1 (최근 30일)
Philip Hoskinson
Philip Hoskinson 2016년 3월 18일
답변: Philip Hoskinson 2016년 3월 18일
I need to import .txt files from different folders, and then read multiple delimiters.
I tried textscan with fullfile, but the variable is empty.
file = fopen(fullfile(folderPath{k},FileNames{i}),'r')
temp = textscan(file,'%u64','MultipleDelimsAsOne',1,'Delimiter',{',''['']'})
fclose(file);
Result is empty file- it's not reading the data. wrong format spec? I tried different ones. Data is just integers.
file =
3
temp =
[0x1 uint64]
Data is in following format in .txt files:
[[ 1 , 2], [3 , 4] ....]]

답변 (1개)

Philip Hoskinson
Philip Hoskinson 2016년 3월 18일
I got a step further - I needed to include '_' (space) delimiter in
'Delimiter',{',' '[' ']' '_' })
Now I have trouble summing matrices:
Error using +
Integers can only be combined with integers of the same
class, or scalar doubles.

카테고리

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