MATLAB Community

MATLAB,社区等

The New Spreadsheet Import Tool

One of the most exciting new features in MATLAB R2011b is theSpreadsheet Import Tool. This tool makes it easy to import data from Microsoft Excel and comma-separated value (CSV) files. The spreadsheet import tool allows you to preview the file and then select the range and format of the data to import. To get started it’s as easy as double-clicking the any .csv or .xls file in the Folder Browser.

For this example, I went todata.gov获取随机的CSV文件。这是获取示例数据集或回答诸如“美国在70年代进口多少高粱?”之类的燃烧问题的绝佳场所?

这是我使用它导入CSV文件时的新工具的样子:

Importing a spreadsheet

默认情况下,该工具希望将数据导入矩阵,使用零以填补空白。通过使用工具栏,您可以快速自定义此过程。第一个下拉列表使您可以在数据类型的矩阵,列向量或单元格数组之间进行选择。矩阵和单元选项将导入一个变量,列向量将为每个选定的列创建一个变量。可以通过在选择顶部的梯形区域中输入梯形区域来快速重命名。

Importing a spreadsheet

This tool is highly interactive. You can quickly choose a subrange using all the normal multi-select gestures (e.g. shift & control click) for your platform. The selections don’t have to be contiguous, but each column has to have the same rows selected, which the tool enforces when you drag around a selection. You can also select a whole row or column by click on its respective header.

Importing a spreadsheet

You also have several options for deciding how to treat blank or non-numeric data. You can set up rules to have rows or columns containing such data automatically excluded, or to have that data replaced by a number, Inf, or NaN. When you do this, those cells are a highlighted in different colors with the new values super-imposed over the original. This allows you to quickly scan the data to make sure you get the desired results.

Finally you can import immediately into the workspace or generate a script or function that would allow you to process other files in the same manner. This is particularly useful if you work with multiple data sets generated in the same fashion.

更动态看看如何使用这个工具,watch the简短视频.

|
  • print
  • send email

注释

To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.