フィルターのクリア

How to export a matlab table as a excel/csv file?

628 ビュー (過去 30 日間)
Andi
Andi 2023 年 5 月 31 日
編集済み: Andi 2023 年 6 月 1 日
Hi everyone,
Mya someone suggest me how i can export the Matlab table as a csv/excel file?

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 5 月 31 日
編集済み: Cris LaPierre 2023 年 5 月 31 日
I suggest using writetable.
writetable determines the file format based on the specified extension. The extension must be one of the following:
  • .txt, .dat, or .csv for delimited text files
  • .xls, .xlsm, or .xlsx for Excel® spreadsheet files
  • .xlsb for Excel spreadsheet files supported on systems with Excel for Windows®
  • .xml for Extensible Markup Language (XML) files

その他の回答 (1 件)

Diwakar Diwakar
Diwakar Diwakar 2023 年 5 月 31 日
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);

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by