Thread Subject: Warning: mxGetPr should no longer ...

Subject: Warning: mxGetPr should no longer ...

From: Carlos Lopez

Date: 4 Dec, 2004 11:32:06

Message: 1 of 6

Hello, everyone:
I am getting the following message on the screen -

"Warning: mxGetPr should no longer be used to access elements of a
logical array.
   Please refer to the Release Notes for information on updating your

code".

As all good behave warning, the program runs without further notice.
I look at the "release notes" but no way (R13 6.5).
Could anyone point to a suitable source? Google provides a couple of
hits, but of no relevance.
Regards
Carlos

Subject: Warning: mxGetPr should no longer ...

From: littlelion2000

Date: 6 Dec, 2004 04:23:30

Message: 2 of 6

may be you can use mxGetData..

/littlelion2000
Carlos Lopez wrote:
>
>
> Hello, everyone:
> I am getting the following message on the screen -
>
> "Warning: mxGetPr should no longer be used to access elements of a
> logical array.
> Please refer to the Release Notes for information on updating
> your
>
> code".
>
> As all good behave warning, the program runs without further
> notice.
> I look at the "release notes" but no way (R13 6.5).
> Could anyone point to a suitable source? Google provides a couple
> of
> hits, but of no relevance.
> Regards
> Carlos

Subject: Warning: mxGetPr should no longer ...

From: Penny Anderson

Date: 7 Dec, 2004 16:40:34

Message: 3 of 6

"Carlos Lopez" <clv2clv@removeThisadinet.com.uy> wrote in message
news:eef504f.-1@webx.raydaftYaTP...
> Hello, everyone:
> I am getting the following message on the screen -
>
> "Warning: mxGetPr should no longer be used to access elements of a
> logical array.
> Please refer to the Release Notes for information on updating your
>
> code".
>
> As all good behave warning, the program runs without further notice.
> I look at the "release notes" but no way (R13 6.5).
> Could anyone point to a suitable source? Google provides a couple of
> hits, but of no relevance.
> Regards
> Carlos

Carlos,

In R13 logical became a full fledged data type, instead of an attribute
tagged on the side of a double (or sparse) array.
With this change, the data became stored as unsigned 8 bit integers.
mxGetPr tries to grab 64 bit double data, so this is inappropriate.
Use mxGetLogicals instead.

http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mxgetlogicals.html

Penny Anderson
The MathWorks, Inc.

Subject: Warning: mxGetPr should no longer ...

From: Carlos Lopez

Date: 8 Dec, 2004 07:51:02

Message: 4 of 6

Penny Anderson wrote:
>
>
> "Carlos Lopez" <clv2clv@removeThisadinet.com.uy> wrote in
message
> news:eef504f.-1@webx.raydaftYaTP...
>> Hello, everyone:
>> I am getting the following message on the screen -
>>
>> "Warning: mxGetPr should no longer be used to access elements
of
> a
>> logical array.
>> Please refer to the Release Notes for information on
updating
> your
>>
>> code".
>>
>> As all good behave warning, the program runs without further
> notice.
>> I look at the "release notes" but no way (R13 6.5).
>> Could anyone point to a suitable source? Google provides a
couple
> of
>> hits, but of no relevance.
>> Regards
>> Carlos
>
> Carlos,
>
> In R13 logical became a full fledged data type, instead of an
> attribute
> tagged on the side of a double (or sparse) array.
> With this change, the data became stored as unsigned 8 bit
> integers.
> mxGetPr tries to grab 64 bit double data, so this is inappropriate.
> Use mxGetLogicals instead.
>
> <http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mxgetlogicals.html>
>
> Penny Anderson
> The MathWorks, Inc.
Thank you for your answer. I applied straightforward the
recomendation, but it does not compile at all.
My (old) code looks like:
double *ptrBool;
        <stuff...>
plhs [0 ] = mxCreateLogicalMatrix(mrows,ncols);
        ptrBool = mxGetPr(plhs [0 ]);
        <more stuff...>
It compiles but complains at run time with warnings (i.e., no damage)
The new code looks like:
double *ptrBool;
        <stuff...>
plhs [0 ] = mxCreateLogicalMatrix(mrows,ncols);
        //ptrBool = mxGetPr(plhs [0 ]);
ptrBool = mxGetLogicals(plhs [0 ]);

I am a completely newbie in C++, so please consider that :-)
Regards
Carlos

Subject: Warning: mxGetPr should no longer ...

From: AJ \"no z\" Johnson

Date: 8 Dec, 2004 10:23:16

Message: 5 of 6

"Carlos Lopez" <clv2clv@removeThisadinet.com.uy> wrote in message
news:eef504f.2@webx.raydaftYaTP...
> Penny Anderson wrote:
> >
> >
> > "Carlos Lopez" <clv2clv@removeThisadinet.com.uy> wrote in
> message
> > news:eef504f.-1@webx.raydaftYaTP...
> >> Hello, everyone:
> >> I am getting the following message on the screen -
> >>
> >> "Warning: mxGetPr should no longer be used to access elements
> of
> > a
> >> logical array.
> >> Please refer to the Release Notes for information on
> updating
> > your
> >>
> >> code".
> >>
> >> As all good behave warning, the program runs without further
> > notice.
> >> I look at the "release notes" but no way (R13 6.5).
> >> Could anyone point to a suitable source? Google provides a
> couple
> > of
> >> hits, but of no relevance.
> >> Regards
> >> Carlos
> >
> > Carlos,
> >
> > In R13 logical became a full fledged data type, instead of an
> > attribute
> > tagged on the side of a double (or sparse) array.
> > With this change, the data became stored as unsigned 8 bit
> > integers.
> > mxGetPr tries to grab 64 bit double data, so this is inappropriate.
> > Use mxGetLogicals instead.
> >
> >
<http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mxgetlogicals.
html>
> >
> > Penny Anderson
> > The MathWorks, Inc.
> Thank you for your answer. I applied straightforward the
> recomendation, but it does not compile at all.
> My (old) code looks like:
> double *ptrBool;
> <stuff...>
> plhs [0 ] = mxCreateLogicalMatrix(mrows,ncols);
> ptrBool = mxGetPr(plhs [0 ]);
> <more stuff...>
> It compiles but complains at run time with warnings (i.e., no damage)
> The new code looks like:
> double *ptrBool;
> <stuff...>
> plhs [0 ] = mxCreateLogicalMatrix(mrows,ncols);
> //ptrBool = mxGetPr(plhs [0 ]);
> ptrBool = mxGetLogicals(plhs [0 ]);
>
> I am a completely newbie in C++, so please consider that :-)
> Regards
> Carlos

Keep type consistency in mind, always. Try:

mxLogical *ptrBool; // Type change
         <stuff...>
plhs[0] = mxCreateLogicalMatrix(mrows,ncols);
ptrBool = mxGetLogicals(plhs[0]); // Types now match

:-) aj

Subject: Warning: mxGetPr should no longer ...

From: Carlos Lopez

Date: 9 Dec, 2004 15:17:56

Message: 6 of 6

AJ \no z\ Johnson wrote:
> Keep type consistency in mind, always. Try:
>
> mxLogical *ptrBool; // Type change
> <stuff...>
> plhs[0] = mxCreateLogicalMatrix(mrows,ncols);
> ptrBool = mxGetLogicals(plhs[0]); // Types now match
It worked fine; thank you a lot!
Carlos

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com