How to export a matlab table as a excel/csv file?
Show older comments
Hi everyone,
Mya someone suggest me how i can export the Matlab table as a csv/excel file?
Accepted Answer
More Answers (1)
Diwakar Diwakar
on 31 May 2023
May be this code with help you.
% Sample table data
data = {'John', 25, 'USA'; 'Alice', 32, 'Canada'; 'Mike', 28, 'Australia'};
headers = {'Name', 'Age', 'Country'};
T = table(data(:,1), data(:,2), data(:,3), 'VariableNames', headers);
% Export as Excel file
excelFile = 'table_data.xlsx';
writetable(T, excelFile, 'Sheet', 'Sheet1');
% Export as CSV file
csvFile = 'table_data.csv';
writetable(T, csvFile);
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!