Halcon算子翻译——assign

时间:2024-01-18 14:25:32

名称

  assign-为控制变量分配一个新的值

用法

  assign( : : Input : Result)

描述

  为控制变量分配一个新的值。

  在全文编辑器中,只需用:=就可以进行赋值,例如:

     u := sin(x) + cos(y)

  这相当于c语言的赋值语法

    u = sin(x) + cos(y);

  如果使用算子窗口来赋值,算子combobox中必须写assign把它作为一个算子,它会打开参数区域。参数Input代表了要输入的变量,即为等号的右侧的值。参数Result为等号左侧的变量。

  

assign assigns a new value to a variable.

In the full text editor an assignment is simply entered with the help of the assignment operator sign :=, e.g.:

u := sin(x) + cos(y)
This is equivalent to the C syntax assignment:

u = sin(x) + cos(y);
If the operator window is used for entering an assignment, assign must be entered into the operator combo box as an operator name. This opens the parameter area, where the parameter Input represents the expression that has to be evaluated to one value and assigned to the variable, i.e., this is the right side of the assignment. The parameter Result gets the name of the variable, i.e., this is the left side of assignment.

参数

  Input(input_control)  real(-array) → (real / integer / string)

    新值

    默认参数:1

  Result (output_control)   real(-array) → (real / integer / string)

    需要赋值的变量

案例(HDevelop)    

Tuple1 := [1,0,3,4,5,6,7,8,9]
Val := sin(1.2) + cos(1.2)
Tuple2 := []

结果

  如果表达式正确,assign返回2(H_MSG_TRUE)。否则否则会引发异常并返回错误代码。

备择方案

  insert

模块

Foundation