Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can i import both text and numeric data via Data import
조회 수: 1 (최근 30일)
이전 댓글 표시
Currently i import the numeric data via the matlab Import data -> select colums -> Matrix. However i need to use the text data from the same while but none of the option help as this just asks me to replace the text data. The data comes from a csv file with a large name so we like to keep the import like that instead of via code.
A small snippet from the data:
;Chipset;HDD;CPU1;MEM1;
43445653;0.01;0.01;0.01;0.00;
43445654;0.02;0.01;0.01;0.01;
43445655;0.03;0.02;0.02;0.01;
43445656;0.04;0.02;0.03;0.02;
I need to use the text chipset, hdd etc in the code but i can't seem to find a way to import both of them as they just replace the text data with NaN. Any suggestions?
댓글 수: 0
답변 (1개)
Tim
2015년 6월 23일
편집: Tim
2015년 6월 23일
fid = fopen('file.csv','r');
C = textscan(fid, repmat('%s',1,10), 'delimiter',';', 'CollectOutput',true);
C = C{1};
fclose(fid);
Also xlsread works on csv's:
[num txt raw] = xlsread(Filename, worksheet);
will put the numerical data in num, text data in text and all of it in a cell array "raw".
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!