How do you transfer numeric data to an excel file?

조회 수: 1 (최근 30일)
Cordelle
Cordelle 2013년 7월 2일
The following code is what i used to try to transfer data from the file passReport.EO1_2013_107_193146 to the excel file EO1_2013_107_193146.xlsx
However, my code failed. Any suggestions on how i can transfer the numeric data will be greatly appreciated.
Code:
*fileID = fopen('passReport.EO1_2013_107_193146');*
*c = textscan(fileID, '%s')*
*fclose(fileID);*
*filename = 'EO1_2013_107_193146.xlsx';*
*caC = {c}; % Stick string into a single cell.*
*xlswrite(filename, caC, 'A1');*

답변 (1개)

Evan
Evan 2013년 7월 2일
편집: Evan 2013년 7월 2일
If you want to read in numeric data, use a specifier like %d, %f, etc. The documentation for textscan gives a full list: http://www.mathworks.com/help/matlab/ref/textscan.html
I replied to your previous question in a comment, but here is a modification to that comment for handling numeric data:
fid = fopen('test.txt'); %test.txt is a text file containing numbers 1:10
t = textscan(fid,'%d');
xlswrite('test.xlsx',t{:}); %data is written to excel cells A1:A10

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by