write different data types to excel sheet
Mostra commenti meno recenti
Hello,
I have a small matrix of data that contains a column of real numbers, a column of integers and a column of cell data. It appears to be stored as cell data, but I would like to keep the format of real, integer and string (different lengths) when I write to an excel spreadsheet. Using writematrix works to write the cell data, but I can't change the data type after that.
line0 is my cell table, and I use:
- writematrix(line0,filename,"Sheet",3,Range="A2:C13")
I could use help with the ability to format the data when writing to the excel file
Risposte (2)
load Variable
T=table(str2double(line0(:,1)), uint32(str2double(line0(:,2))), line0(:,3), 'Var',CCHdr )
writetable(T,'out.xlsx')
"It appears to be stored as cell data"
It is clearly stored as a string array:
S = load('Variable.mat')
S.line0
T = array2table(S.line0, 'VariableNames',S.CCHdr);
T = convertvars(T,[1,2],@double)
writetable(T,'myexcel.xlsx')
Categorie
Scopri di più su Data Import from MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!