How do you transfer numeric data to an excel file?

1 visualizzazione (ultimi 30 giorni)
Cordelle
Cordelle il 2 Lug 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');*

Risposte (1)

Evan
Evan il 2 Lug 2013
Modificato: Evan il 2 Lug 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

Categorie

Scopri di più su Data Import from MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by