when i tried run something from excel it shows error?

조회 수: 2 (최근 30일)
Logeswaran pitchai muthaiyah
Logeswaran pitchai muthaiyah 2020년 12월 1일
%load('Ftr.mat'); %load first 1000 data
Data=xlsread('data.xlsx','Sheet1');
Ftrain= Data(1:1:990);
Ftest=Data(1:1:1000);
when i run this. i got this error.
>> Ftrain= Data(1:1:990)
Subscripting into a table using one subscript (as in t(i)) or three or more subscripts (as in t(i,j,k)) is
not supported. Always specify a row subscript and a variable subscript, as in t(rows,vars).

답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 1일
Ftrain = Data(1:990, :);
Ftest = Data(991:1000, :);
Note that this will return the same datatype that Data is -- if Data is a table then Ftrain and Ftest will be tables as well.
Your code shows you using xlsread() but xlsread() can never return table objects. The first output of xlsread() is strictly numeric. You would have had to have used readtable() to get a table returned.
See also readmatrix()
  댓글 수: 2
Logeswaran pitchai muthaiyah
Logeswaran pitchai muthaiyah 2020년 12월 1일
thanks it gone through
Logeswaran pitchai muthaiyah
Logeswaran pitchai muthaiyah 2020년 12월 1일
data = xlsread('data.xlsx','Sheet1');
Ftrain= data(1:1:990);
Ftest=data(1:1:1000);
X=Ftrain;
[n,p] = size(X); %n = number of observations/samples
%mean
c=mean(X);
;
%standard deviation
d=std(X);
%Upper control limimt
UCL=c+3*d;
x=repmat(UCL,n,1);
when i tried to run mean it shows one error.
c=mean(X)
Error using sum
Invalid data type. First argument must be numeric or logical.
Error in mean (line 127)
y = sum(x, dim, flag) ./ mysize(x,dim);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by