Why do I receive the warning message "mxGetPr should no longer be used with logical data type" when creating MEX function?

1 view (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This error occurs only if you pass a logical array as an input to your C-MEX function and use MXGETPR to extract the data from the same.
Logical datatypes were represented as double data until MATLAB 6.1 (Release 12.1). Starting with MATLAB 6.5 (R13), logical data type is a separate class. Since MXGETPR can only be used with double data type, you get the above-mentioned error.
As a solution, you can either convert the data to double using the DOUBLE function before passing it to your C-MEX function or use mxGetLogicals in your C-code.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!