NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

LABVIEW常量赋值问题

想要在程序中定义一个常量作为比例系数K,在运行过程中根据计算结果对K进行重新赋值。
简单来说 就是如何实现如下代码:
UINT16 K=0  ;  //比例系数
result_celiang=0;// 实际测量值
result_lixiang=5;// 理想值,理论值

int main()
{   
      /......  .....
        .......
      /                //得到实际测量值
  result_celiang=4.986;  //得到实际测量值
  K=result_lixiang/result_celiang;//利用测量值和理想值修正K的(每测量十次修正一次)
     
}
0 项奖励
1 条消息(共 2 条)
3,967 次查看

Suppose that you have created an numeric indicator i.e. K of UINT16.

At code initialization, input 0 to K.

 

During main code execution...

At when new K value is to be updated, simply write that computed value to K's local variable.

 

In other word, upon initialized the K value before the main code, simply "right-click" K and create a local variable of it. Then, update new K's value with this local variable.

 

PS: Global Variable could also be used in this case. 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
2 条消息(共 2 条)
3,942 次查看