matlab xlsread
时间: 2023-09-11 08:09:07 浏览: 25
xlsread is a function in MATLAB that allows you to read data from an Excel file. The function takes the following syntax:
```
[num,txt,raw] = xlsread(filename,sheet,range)
```
- `num` is a numeric array that contains the data from the specified range in the Excel file.
- `txt` is a cell array that contains any text from the specified range.
- `raw` is a cell array that contains both text and numeric data from the specified range.
- `filename` is the name of the Excel file.
- `sheet` is the name or index number of the worksheet from which to read data.
- `range` is the range of cells to read from the worksheet.
Here's an example of how to use xlsread to read data from an Excel file:
```
filename = 'data.xlsx';
sheet = 'Sheet1';
range = 'A1:B5';
[num,txt,raw] = xlsread(filename,sheet,range);
```
This would read the data from cells A1 through B5 in Sheet1 of the Excel file "data.xlsx" and store the numeric data in `num`, the text data in `txt`, and both types of data in `raw`.