How do you transfer numeric data to an excel file?

1 vue (au cours des 30 derniers jours)
Cordelle
Cordelle le 2 Juil 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');*

Réponses (1)

Evan
Evan le 2 Juil 2013
Modifié(e) : Evan le 2 Juil 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

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by