LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Help: To compare values in CVI?

Hi
Please help my question:
 
compare if a value is >, =>, <, or <= in CVI????.  Smiley Indifferent
 
for example:
 
V1 = 10
V2 = 5
 
if V2 => 10 Show MessagePopup ("MSG", "Aouchh if <  ");
 
Or
 
V1 = 19
If V1 <=20  Show MessagePopup ("MSG", " Oks if  <");
 
 
Smiley Sad One example please!!!!!.
0 Kudos
Message 1 of 5
(3,699 Views)
If I understood you, it is simple.

if ( v2 >= 10 ) {
MessagePopup ("MSG", "Aouchh if <  ");
}

if ( V1 <=20 ) {
 MessagePopup ("MSG", " Oks if  <");
}


See ya
Message 2 of 5
(3,694 Views)
Smiley SurprisedThis type code failure, show error to compare values.
 
 
on this msg add my example for you help
 
 
 
ThanksSmiley Wink
0 Kudos
Message 3 of 5
(3,688 Views)
Are you trying to compare a String to a double?

I suggest you to use a numeric data type to input the value that you want. There is an option to you choose the right data type. Or you can use a pointer to char and then convert the String to a double using atof command before to compare.



0 Kudos
Message 4 of 5
(3,683 Views)
Smiley Happy Ok thanks, with your help my problem was resolved using this code:
 
using Variable double V1;
__________________________________________
 
void COMPARE (void)
{
 
 GetCtrlVal (PANEL, PANEL_STRING, V2);
 V1= atof(V2);
  
  if (V1>=2.7)MessagePopup ("MSG", "Result is good, is = or >");
 return;
}
 
___________________________________________
 

Mensaje editado por avalosro

0 Kudos
Message 5 of 5
(3,680 Views)