From: andrew Min Wei on
i have received the message saying that i have the error:
??? Index exceeds matrix dimensions.
Error in ==> andrew at 6
s1 = x(2:112, 10:12);
i'm not sure what is the problem
this is my coding:
%These 5 signature samples will be stored in the database as reference
%signature.

%Transfer the first signature sample data from Excel into Matlab
x = xlsread('C:\Users\C.L Yap\Desktop\andrew1.xlsm');
s1 = x(2:112, 10:12);

%remove data outliers
mu = mean(s1);
sigma = std(s1);

[n,p] = size(s1);
%Create a matrix of mean values by replicating the mu vector for n rows
meanmat = repmat(mu,n,1);
%Create a matrix of standard deviation values by replicating the sigma
%vector for n rows
sigmamat = repmat(sigma,n,1);
%Create a matrix of zeros and ones, where ones indicate the location of the
%outliers
outliers = abs(s1-meanmat) > 3*sigmamat;
%Calculate the number of outliers in each column
nout = sum(outliers);
%To remove an entire row of data containing the outlier
s1(any(outliers,2),:) = [];

%Extract 1st feature: length
n0 = size (s1)*[1 0]';
n1 = [n0 n0 n0];

%Extract 2nd feature: average value
a1 = mean(s1);

%Extract 3rd feature: standard deviation
d1 = std(s1);

%Extract 4th feature: trend coefficient
b1 = 0.5 .* n1 .* (n1 + 1);
c1 = (1/6) .* n1 .* (n1 + 1) .* (2 .* n1 + 1);
k1 = 1:n0;
q1 = k1*s1;
z1 = (1./n1) .* q1;
e1 = std(k1);
p1 = z1- (b1 .* a1)./(d1 .* e1);
r1 = (p1 .* d1) /e1;

%Arrange the 4 features extracted from the first signature sample
F11 = [n1;a1;d1;r1];
F11 = F11(:);

%Transfer the second signature sample data from Excel into Matlab
x = xlsread('C:\Users\C.L Yap\Desktop\andrew2.xlsm');
s2 = x(2:124, 10:12);

mu = mean(s2);
sigma = std(s2);

[n,p] = size(s2);

meanmat = repmat(mu,n,1);
sigmamat = repmat(sigma,n,1);
outliers = abs(s2-meanmat) > 3*sigmamat;
nout = sum(outliers);
s2(any(outliers,2),:) = [];

n0 = size (s2)*[1 0]';
n2 = [n0 n0 n0];

a2 = mean(s2);

d2 = std(s2);

b2 = 0.5 .* n2 .* (n2 + 1);
c2 = (1/6) .* n2 .* (n2 + 1) .* (2 .* n2 + 1);
k2 = 1:n0;
q2 = k2*s2;
z2 = (1./n2) .* q2;
e2 = std(k2);
p2 = z2- (b2 .* a2)./(d2 .* e2);
r2 = (p2 .* d2) /e2;

F12 = [n2;a2;d2;r2];
F12 = F12(:);

%Transfer the third signature sample data from Excel into Matlab
x = xlsread('C:\Users\C.L Yap\Desktop\andrew3.xlsm');
s3 = x(2:115, 10:12);

mu = mean(s3);
sigma = std(s3);

[n,p] = size(s3);

meanmat = repmat(mu,n,1);
sigmamat = repmat(sigma,n,1);
outliers = abs(s3-meanmat) > 3*sigmamat;
nout = sum(outliers);
s3(any(outliers,2),:) = [];

n0 = size (s3)*[1 0]';
n3 = [n0 n0 n0];

a3 = mean(s3);

d3 = std(s3);

b3 = 0.5 .* n3 .* (n3 + 1);
c3 = (1/6) .* n3 .* (n3 + 1) .* (2 .* n3 + 1);
k3 = 1:n0;
q3 = k3*s3;
z3 = (1./n3) .* q3;
e3 = std(k3);
p3 = z3- (b3 .* a3)./(d3 .* e3);
r3 = (p3 .* d3) /e3;

F13 = [n3;a3;d3;r3];
F13 = F13(:);

%Transfer the fourth signature sample data from Excel into Matlab
x = xlsread('C:\Users\C.L Yap\Desktop\andrew4.xlsm');
s4 = x(2:113, 10:12);

mu = mean(s4);
sigma = std(s4);

[n,p] = size(s4);

meanmat = repmat(mu,n,1);
sigmamat = repmat(sigma,n,1);
outliers = abs(s4-meanmat) > 3*sigmamat;
nout = sum(outliers);
s4(any(outliers,2),:) = [];

n0 = size (s3)*[1 0]';
n4 = [n0 n0 n0];

a4 = mean(s4);

d4 = std(s4);

b4 = 0.5 .* n4 .* (n4 + 1);
c4 = (1/6) .* n4 .* (n4 + 1) .* (2 .* n4 + 1);
k4 = 1:n0;
q4 = k4*s4;
z4 = (1./n4) .* q4;
e4 = std(k4);
p4 = z4- (b4 .* a4)./(d4 .* e4);
r4 = (p4 .* d4) /e4;

F14 = [n4;a4;d4;r4];
F14 = F14(:);

%Transfer the fifth signature sample data from Excel into Matlab
x = xlsread('C:\Users\C.L Yap\Desktop\andrew5.xlsm');
s5 = x(2:115, 10:12);

mu = mean(s5);
sigma = std(s5);

[n,p] = size(s5);

meanmat = repmat(mu,n,1);
sigmamat = repmat(sigma,n,1);
outliers = abs(s5-meanmat) > 3*sigmamat;
nout = sum(outliers);
s5(any(outliers,2),:) = [];

n0 = size (s5)*[1 0]';
n5 = [n0 n0 n0];

a5 = mean(s5);

d5 = std(s5);

b5 = 0.5 .* n5 .* (n5 + 1);
c5 = (1/6) .* n5 .* (n5 + 1) .* (2 .* n5 + 1);
k5 = 1:n0;
q5 = k5*s5;
z5 = (1./n5) .* q5;
e5 = std(k5);
p5 = z5- (b5 .* a5)./(d5 .* e5);
r5 = (p5 .* d5) /e5;

F15 = [n5;a5;d5;r5];
F15 = F15(:);

F = [F11 F12 F13 F14 F15];

I get the data from the excel macro enabled file..i'm not sure what is happening..pls,someone help me :(

thanks in advance
From: ImageAnalyst on
On Mar 27, 4:29 pm, "andrew Min Wei" <andrewli...(a)hotmail.com> wrote:
> i have received the message saying that i have the error:
> ??? Index exceeds matrix dimensions.
> Error in ==> andrew at 6
> s1 = x(2:112, 10:12);
> i'm not sure what is the problem
---------------------------------------
andrew Min Wei:
Put a break point at the s1 line. Then check out the size of x.
Chances are it's not 112 rows by 12 columns or larger. Most likely
it's smaller in at least one dimension and that would cause your error
because you can't grab stuff outside of your x array and stuff it in
to s1 - it just plain does not exist so there is nothing to grab.
From: andrew Min Wei on
I have checked at the workspace, and the x value is <111x10 double>, is it the size of the x? and how to change it? cause i always got error saying that i did not use the correct Matlab syntax, although i change according to the <111x10 double> style..i'm not sure what is the problem still..newbie of Matlab >.<
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <61be36f5-da5b-4971-b7f1-2459d0c4dedf(a)r27g2000yqn.googlegroups.com>...
> On Mar 27, 4:29 pm, "andrew Min Wei" <andrewli...(a)hotmail.com> wrote:
> > i have received the message saying that i have the error:
> > ??? Index exceeds matrix dimensions.
> > Error in ==> andrew at 6
> > s1 = x(2:112, 10:12);
> > i'm not sure what is the problem
> ---------------------------------------
> andrew Min Wei:
> Put a break point at the s1 line. Then check out the size of x.
> Chances are it's not 112 rows by 12 columns or larger. Most likely
> it's smaller in at least one dimension and that would cause your error
> because you can't grab stuff outside of your x array and stuff it in
> to s1 - it just plain does not exist so there is nothing to grab.
From: Steven Lord on

"andrew Min Wei" <andrewli_87(a)hotmail.com> wrote in message
news:hon6h6$3a8$1(a)fred.mathworks.com...
>I have checked at the workspace, and the x value is <111x10 double>, is it
>the size of the x?

Yes. You're asking for something in the 112th row of a matrix with only 111
rows; MATLAB (correctly) says "I don't know how to do that; x doesn't _have_
112 rows!" And even if it had 112 rows, it would still only have 10 columns
so asking for something in the 11th or 12th columns would still throw this
same error.

> and how to change it?

Well, since the code that you posted indicates that x was created by a call
to XLSREAD, my first step would be to look at the Excel file that you're
trying to read in, to make sure it has at least 112 rows of data and at
least 12 columns. If it doesn't, you need to determine why and how to fix
it since you're the only one who knows what's in that file. (Before you
suggest it please do NOT post your Excel file; binary files are not allowed
on this newsgroup since the name of the group does not include the word
'binary'.)

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: andrew Min Wei on
actually my data in excel ranging from the row 2 to 112 and from the column 10 to 12 ONLY. Means that the in the previous column, i do not have any numerical numbers or data in the excel cells..is this making all the problem?