急求!!!matlab中xlsread使用出错

A=xlsread('Names','sheet1',':,B');
Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for
more information.
> In xlsread at 176
Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded.
> In xlsread at 184
??? Error using ==> xlsread at 234
XLSREAD unable to read sheet sheet1.
Requested sheet: 'sheet1' not found.
其中excel文件存放在文档中的matlab文件夹里,而我想调用其中第二列的数据却掉不出来。我想调其中的字符串而非数字怎么调用?谢谢

建议这么写:
[N, T, rawdata] = xlsread('Names', 'sheet1'); % rawdata为所读excel的所有内容, cell型
% N = excel中的数字内容
% T = excel中的文本内容
A = rawdata(:, 2); % 取出rawdata中的第二列
或写成
[~, ~, rawdata] = xlsread('Name', 'sheet1'); % 忽略前两个输出参数
A = rawata(:, 2);

你的代码存在三个问题:
1. 读取excel的某一列要用'B:B",而不是':, B';
2. 即使用用'B:B',会读入很多空数据,估计也不是你想要的
3. A = xlsread(...), 取的只是excel表中的数字参数,你的excel里有字符串,最好使用第三个参数
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-07-07
重新安装matlab
相似回答