</pre><p></p><pre code_snippet_id= "1932623" snippet_file_name= "blog_20161019_2_405111" name= "Code" class= "cpp" > int bb = ten;
int cc = aa% BB;
int dd = aa/bb;
cout << cc << Endl << dd <<endl;
cout << "CNT:" << cnt << Endl;
Output results:
3
23
%: Take the remainder
/: Divide division to divide the number of parts
(The difference with MATLAB code)
Double AA = 24.4;
Double bb = 3.2;
Double cc = aa/bb;
cout << "AA bb cc:" << aa << " " << bb << " " << cc <<endl;
Double A = 24.4;
int b = 3;
Double C = A/b;
cout << "a b C:" << a << " " << b << " " << c << Endl;
Matlab:
% to calculate gain% of RGB three channel
Rgain = Ymax/rav
Ggain = Ymax/gav
Bgain = Ymax/bav
Ymax = 235
Rav = 133.4989
Gav = 123.8576
Bav = 149.9403
Odd, you need to use the gain factor, but the output is an integer 2
Command calculation at the command line can clearly output floating-point results
/rdivide matlab Help document Explanation:
Integer Division
Divide a int16 scalar value by each element of the int16 vector.
A = Int16 (a);
b = Int16 ([3 4 6]);
x = a./b
x =
3 3 2
Matlab®rounds the results when dividing integer data types. For integers, rounding the result is a solution:
Divides the% two integers, converts the denominator to a double, and the output is a double type.
SUMR = SUM (sum (R))
Rav = Double (SUMR)/CNDDT
Output results:
Rav = 133.4989