From: busra on
hi all,

I wrote the code to read the training images and then I formed a matrix using the face images as a column of this matrix. I applied pca on this matrix by using princomp but this error is shown:
"??? Error using ==> minus
Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> princomp at 50
x0 = x - repmat(mean(x,1),n,1);"

can you help me, please?
From: Wayne King on
"busra " <busrakaya_86(a)hotmail.com> wrote in message <hk2gbs$29n$1(a)fred.mathworks.com>...
> hi all,
>
> I wrote the code to read the training images and then I formed a matrix using the face images as a column of this matrix. I applied pca on this matrix by using princomp but this error is shown:
> "??? Error using ==> minus
> Integers can only be combined with integers of the same class, or scalar doubles.
> Error in ==> princomp at 50
> x0 = x - repmat(mean(x,1),n,1);"
>
> can you help me, please?

Hi, what is the data type of x? If you type

class(x)

If you're getting something like int8, etc. Try changing x to double with

x = double(x);

and see if that fixes your problem in princomp().

Wayne
From: busra on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hk2qrm$fs1$1(a)fred.mathworks.com>...
> "busra " <busrakaya_86(a)hotmail.com> wrote in message <hk2gbs$29n$1(a)fred.mathworks.com>...
> > hi all,
> >
> > I wrote the code to read the training images and then I formed a matrix using the face images as a column of this matrix. I applied pca on this matrix by using princomp but this error is shown:
> > "??? Error using ==> minus
> > Integers can only be combined with integers of the same class, or scalar doubles.
> > Error in ==> princomp at 50
> > x0 = x - repmat(mean(x,1),n,1);"
> >
> > can you help me, please?
>
> Hi, what is the data type of x? If you type
>
> class(x)
>
> If you're getting something like int8, etc. Try changing x to double with
>
> x = double(x);
>
> and see if that fixes your problem in princomp().
>
> Wayne

it is interesting that yesterday it didn't work but today there isn't any problem. I had written the code like you said, thanks for your interest..