Hello, friends.
Today we will discuss how to call a multiplication function from Python to leave you for that purpose.
I already create a copy of subtraction.
I just want to change its name.
It is multiply ull.
And over here I want to adjust.
I also the name of python code is also changed so I just rename it complete name I want to place over
here am ul
multi life so over here and this is my sub vi.
So first I want to change the sub via let's see.
So this is my again same current vi part strip part, build part, append part and over here this is
the part for subtraction.
I want to change it to multiply.
So I just rename it, copy this and just place this name over here so it will create path for it or
append path for it.
So let's check as you see see user.
So no comment by turn, integration by code multiply.
So this is done.
Now I want to change the name.
So from here it is mu l multiplied oc so oc controller's save the sub v is saved.
Now I want to just change the python code because earlier it is written in return for subtraction.
So I just open, I just go to the command python integration by code multiply open this code.
So as you see, the code is written for the subtraction.
So now I just define another function multiply.
Okay.
So in this case also I have two variable x and y and now I want to multiply this x into y and the result
is this.
So I want to also check the result.
So let's say print.
Okay.
And I also want to define the value of X and Y.
So for that purpose, multiply the value of X is, let's say three, comma five.
So the results would be 15.
So I just save it, run it.
So as you see, the result is 15.
So I just minimize this.
So I do not require this command and this command also.
So this is my code for multiplication.
Just save it.
Close this.
And now I just go to the main die.
So I just copy this.
Or let's create a new Y for this purpose.
So if I knew y control d over here, just call connectivity, python code and this open python session.
Then we require python node.
Then we have to close the python.
So as you see over here, I want to visible its labels.
Then I want to arrange it.
So connect session now to session in session output.
Session in error.
How to error in like this or here you have to create the version.
The version is 3.9.
Then you have to give the path of the module so it will come from code.
This is my VI, so I just copy this.
This one I already save.
That is MLE.
So just connect this over here.
You have to put the function name.
The name of the function is amu l multi ply.
So as you see over here and then you have to put the constant because what type of variable you want.
So let's say in this case I just DB constant that is zero connect this and in this I want to create
control for x and Y.
So I just go over here.
So numeric control for x, this is my x and numeric control for y, this is my y and I also require
indicator.
So here is my numeric indicator.
It will produce x into y.
Okay.
So just connect.
So this will connect it to this first variable.
This is my second variable.
And over here, this is my result.
Okay, so my program is done.
I also create a simple error handler, as you see, and just label it
visible label.
And for the continuous reading or continuous calling, I just create a y loop over here.
Create a control for this now control you.
It will minimize the space.
So let's check the result of these two.
Let's say three and two.
Five,
right?
As you see, I got 15 over here and if you four into five, 25 and five, 25.
So this code is similar to the function in the toolbox numeric multiply.
So as you see over here, I just create control for this.
This is my x variable.
This is my y variable.
It is by two because x and y is already used or and or.
Here this is my indicator.
And for the while continuous
operation I just create a value.
So this code and this code are both are similar to this code is in lab view and this code is for the
python code.
So this is how you can multiply.
Or you can call a multiply function from python to leave you.
Thank you.