Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Newbie mvregress

Subject: Newbie mvregress

From: Michael

Date: 8 Jan, 2010 19:23:06

Message: 1 of 3

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?

Subject: Newbie mvregress

From: Tom Lane

Date: 8 Jan, 2010 21:04:49

Message: 2 of 3

> ??? 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

Subject: Newbie mvregress

From: Michael

Date: 8 Jan, 2010 21:28:04

Message: 3 of 3

"Tom Lane" <tlane@mathworks.com> wrote in message <hi86li$4ip$1@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.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us