큰 탭으로 구분 된 파일 (10000 행, 15000 열)을 MATLAB으로 가져오고 싶습니다.textscan을 사용하여 파일을 읽는 방법?
내가 textscan 기능을 다음과 같은 방법으로 사용하여 가져 오기 시도했다 :
function [C_text, C_data] = ReadDataFile(filename, header, attributesCount, delimiter,
attributeFormats, attributeFormatCount)
AttributeTypes = SetAttributeTypeMatrix(attributeFormats, attributeFormatCount);
fid = fopen(filename);
if(header == 1)
%read column headers
C_text = textscan(fid, '%s', attributesCount, 'delimiter', delimiter);
C_data = textscan(fid, AttributeTypes{1, 1}, 'headerlines', 1);
else
C_text = '';
C_data = textscan(fid, AttributeTypes{1, 1});
end
fclose(fid);
AttributeTypes {1, 1}이 경우이 14,740 플로트하고 (문자열 느릅 나무는 각 열에 대한 변수 유형을 설명입니다 260 문자열 유형 변수 그래서 AttributeTypes {1, 1}의 값이 '% f % f ...... % f % s % s ... % s인데, 여기서 % f는 14740 번과 % s260 번 반복됩니다) .
나는 배열 (열 이름이 올바르게 읽은) 올바른 것 같다
>> [header, data] = ReadDataFile('data/orange_large_train.data.chunk1', 1, 15000, '\t', types, size);
헤더를 실행하려고합니다.
데이터은 1 x 15000 배열 (첫 번째 행만 10000 대신 가져 오기되었습니다)이며 이러한 동작을 일으키는 지 알지 못합니다.
C_data = textscan(fid, AttributeTypes{1, 1});
을하지만 도움말 참조 설명 유사한 예 있기 때문에 잘못 될 수 있는지 모르겠어요
나는 문제는이 라인에서 발생 같아요.
누구든지이 문제에 대한 해결책을 제시하면 매우 감사 할 것입니다. - 모든 10000 행을 읽는 방법.