- The simplest way, if you're new to Matlab, is use the the file import tool. It's under the File menu > Import Data.
- You can also call the import scripts from the command line. For instance https://www.mathworks.com/help/matlab/ref/xlsread.html is probably the command you're looking for. In your example, [numbers,text,all] = xlsread(filename,1,'A1:I3') would read in your information as three matrices, one holding the numbers, the other holding the non-numeric parts (and one of the original data).
- The importdata command might also be useful: the documentation is here: http://www.mathworks.com/help/matlab/ref/importdata.html
getting a matrix from Excel data
156 ビュー (過去 30 日間)
回答 (1 件)
jgg 2015 年 12 月 4 日
There are a couple of ways.
I think in general, if you have mixed data that's both numeric and non-numeric, it's a good idea to try and use the tool first. Some of the other tools may not give you output in the format you expect, or can throw an error if they encounter unexpected data. It will also allow you to handle errors or missing data more naturally.
Check this out for some more information: http://www.mathworks.com/help/matlab/import_export/recommended-methods-for-importing-data.html