How can I label a solution as NaN in a MEX code?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
AP
am 24 Jun. 2014
Bearbeitet: José-Luis
am 24 Jun. 2014
I am using solvers of LAPACK libraries in a MATLAB MEX file for solving linear system of equations. For some of the cases, the system that I solve is singular. For example, the system is as follows for one of my cases:
A =
0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 77.31867171
b:
-0.00000000 -0.00000000 -0.00000000
What would be the best approach to label this solution as NaN similar to MATLAB?
0 Kommentare
Akzeptierte Antwort
James Tursa
am 24 Jun. 2014
Use the API function mxGetNaN:
E.g., to put a NaN value into a double for returning to the MATLAB workspace:
double d = mxGetNaN( );
0 Kommentare
Weitere Antworten (1)
José-Luis
am 24 Jun. 2014
if (some_condition)
some_value = 0.0/0.0; %This will produce a NaN
end
4 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!