Trying to get MATLAB to export multiple files on to different sheets
1 view (last 30 days)
Show older comments
Hi everyone,
1) I'm trying to xlswrite all of the 'stm{k}' vectors onto Excel with each vector on a different sheet but, it seems to only export the first vector multiple times.
2) I would like to string the columns prior to exporting 'stm{k}' onto Excel. Right now, it's splitting 'H H : M M : S S . f f f' into seperate columns . I'm trying to get them all into one cell 'HH:MM:SS.fff' (on Excel it's the concatenate function for joining together strings).
folder='X';
filetype='*.xlsx';
f = fullfile(folder,filetype);
d = dir(f);
% Read all excel files in folder
for k=1:numel(d)
de{k}=xlsread(fullfile(folder,d(k).name),'D:D');
stm{k} = datestr(seconds(de{k}),'HH:MM:SS.fff'); % Convert seconds into time format
% Output as Excel
for sheet=1:numel(d)
xlswrite('excel_name',stm{k},sheet);
end
end
Thank you!
0 Comments
Accepted Answer
Image Analyst
on 7 Dec 2018
What if you try
sheetName = sprintf('Sheet %d', k);
xlswrite('excel_name.xlsx',stm{k}, sheetName);
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!