How do you transfer numeric data to an excel file?

1 Ansicht (letzte 30 Tage)
Cordelle
Cordelle am 2 Jul. 2013
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');*

Antworten (1)

Evan
Evan am 2 Jul. 2013
Bearbeitet: Evan am 2 Jul. 2013
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

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by