ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

double and float

Why doesn't it work?
 
i have the dll like this:
 
But in Labview(see attachment ResMap.vi) ,it will be overlap, how can i do it right?  (I mean, what's wrong with the data typ converting?)
 
 
void __declspec(dllexport) __stdcall ResMap(float *ResMap,int imgwidth, int imgheight)
{
double dotpitch,e_pixel,d,e_degree,f_eye_cpd,dpp,f_eye_cpp;
 
dotpitch = Wd / imgwidth;
 
for (int x=0;x<imgwidth;x++)
 for(int y=0;y<imgheight;y++)
 {
e_pixel =sqrt((double)((x-imgwidth/2)^2 + (y-imgheight/2)^2));
... ...

f_eye_cpp = f_eye_cpd * dpp;
ResMap[x+imgwidth*y]= (float)f_eye_cpp;
... ...
 
}
 
}
 
 
0 Kudos
Message 1 of 5
(3,417 Views)
I can't open the VI since I only have LabVIEW 8.2. I can say, however, that "float" is actually a vague representation, as it can mean multiple precisions. See here. You need to see how your compiler defines float, and then you can see which LabVIEW data type matches it.
0 Kudos
Message 2 of 5
(3,413 Views)
Thanks!Smiley Happy
0 Kudos
Message 3 of 5
(3,408 Views)
If I write it as :  void __declspec(dllexport) __stdcall ResMap(double*ResMap,int imgwidth, int imgheight), it still not correct. It compiles in VC without errors, even if i run it in Labview without error-Infos either,but the result is not what i want. Something is went wrong. (The correct Image should like a white "sun" in the black backgrund)
 
 
0 Kudos
Message 4 of 5
(3,395 Views)
Unfortunately, as I said, I can't open your VI since I don't have LabVIEW 8.5, and I don't know how your DLL is supposed to be used, otherwise I'd just create my own VI in 8.2. If you resave your VIs in 8.2 I can take a look at them for you. Otherwise, someone with 8.5 can take this up.
0 Kudos
Message 5 of 5
(3,388 Views)