From: Michael on
Hi

I am getting data from MySql. I would like to take retrieved columns of numeric data and do multivariat regressions....
The below code generates an error - if anyone can help me - much appreciated

conn = database('DataBase','','Password');

% Read data from database.

e = exec(conn,'SELECT * FROM SPX');
SpxDB = fetch(e);
numSpxRows = rows(SpxDB);

% load independant variables
X = [ones(numSpxRows),SpxDB.Data(:,9)'];

%for simplicity I just regress on the same data

y = SpxDB.Data(:,9)';

b = mvregress(X,y);

??? Undefined function or method 'isnan' for input arguments of
type 'cell'.

Error in ==> mvregress at 229
if isempty(EstMethod) && ~any(isnan(Data(:)))

How do I get around the type 'cell' problem?
From: Tom Lane on
> ??? Undefined function or method 'isnan' for input arguments of
> type 'cell'.
>
> Error in ==> mvregress at 229
> if isempty(EstMethod) && ~any(isnan(Data(:)))
>
> How do I get around the type 'cell' problem?

Michael, it looks like the Data variable you passed into mvregress is a cell
array rather than a numeric vector or matrix. Check to see if your fetch()
call is returning a structure with a cell array in the specified field.

-- Tom


From: Michael on
"Tom Lane" <tlane(a)mathworks.com> wrote in message <hi86li$4ip$1(a)fred.mathworks.com>...
> > ??? Undefined function or method 'isnan' for input arguments of
> > type 'cell'.
> >
> > Error in ==> mvregress at 229
> > if isempty(EstMethod) && ~any(isnan(Data(:)))
> >
> > How do I get around the type 'cell' problem?
>
> Michael, it looks like the Data variable you passed into mvregress is a cell
> array rather than a numeric vector or matrix. Check to see if your fetch()
> call is returning a structure with a cell array in the specified field.
>
> -- Tom
>
Thanks .. you are correct .. I think using cell2mat will help me!!! This function converts cells to doubles.