long5683

[NUM,TXT,RAW]=xlsread(\'example\',2,\'B2:B261\')

NUM返回的是excel中的数据,

TXT输出的是文本内容,

RAW输出的是未处理数据

example:是需要读取的文件名称,带后缀

2:是读第几个表,这里是指读第二个表格

\'B2:B261\':表格中的范围

 

function [data,label]=getdata(xlsfile)
% [data,label]=getdata(\'student.xls\')
% read height,weight and label from a xls file

[~,label]=xlsread(xlsfile,1,\'B2:B261\');
[height,~]=xlsread(xlsfile,\'C2:C261\');
[weight,~]=xlsread(xlsfile,\'D2:D261\');

data=[height,weight];
l=zeros(size(label));
for i=1:length(l)
   if label{i}== \'ÄÐ\'
       l(i)=1;
   end
end

label=l;

 

分类:

技术点:

相关文章: