c++ - How to Code max(abs) in MATLAB -


i have following code in matlab trying rewrite in mex file using c (or c++):

[a,b] = max(abs(c)); 

where c vector, maximum absolute value of elements in vector c, , b index of a.

please can me solution this? tried use "abs" function returned positive integers (but want them remain double decimal values included). many in advance.

man abs tells why got result: abs -- integer absolute value function

you want fabs here: "floating-point absolute value function". note need include math.h (abs in stdlib.h).


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -