电子表格
Microsoft® Excel® 电子表格
在电子表格文件中读写数据,包括将 .xls
和 .xlsx
中的数据写入 MATLAB® 中的表、时间表、矩阵或数组。您可以导入所选范围的数据,也可以从电子表格文件中导入多个工作表。
App
导入工具 | 从文件导入数据 |
实时编辑器任务
导入数据 | Import data from a file in the Live Editor (自 R2023a 起) |
函数
对象
spreadsheetDatastore | 用于电子表格文件的数据存储 |
主题
读取电子表格数据
- 导入电子表格
电子表格,(如 Microsoft Excel 文件)通常包含数值和文本数据以及变量名称和行名称的混合。在 MATLAB 中表示电子表格数据的最常见方式是使用表,但您也可以在 MATLAB 中将电子表格数据表示为时间表、矩阵或元胞数组。 - 使用导入工具读取电子表格数据
预览文件或剪贴板中的电子表格数据,并使用导入工具选择要导入的数据。 - 将电子表格数据读入到表中
在 MATLAB 中表示电子表格数据的最佳方式是表,因为表可以存储异构(数值和文本的混合)数据以及变量名称和行名称。 - Control How MATLAB Imports Your Data
If you want to control the import process beyond the options provided by thereadtable
function, such as defining how to handle missing data or errors, then create an import options object before importing the data. - 将电子表格数据读入数组或单个变量
除了使用readtable
将数据作为表导入之外,您还可以将数据作为矩阵、元胞数组导入,或将单独的变量直接导入工作区。 - Read Collection or Sequence of Spreadsheet Files
Read and manage data from a collection of spreadsheet files.
写入电子表格数据
- 将数据写入 Excel 电子表格
将工作区中的数据导出到 Microsoft Excel 电子表格文件。