01-24-2018 11:38 PM
Hi,
Can I change value of input (control) through code in mathscript?
Like I have this kinda thing to do.
if x >5
led = 1
x = 0
end
like I want to check if x is greater than 5? if yes then turn led ON and then make x = 0.
Can I do this in labview mathscript coding?
01-26-2018 01:51 PM
Yes this can be achieved through the use of property nodes. You can create a property node by right-clicking on the control you want to update, and then write a boolean true or false to that property node from your mathscript node based on the value of x. Here is an example of modifying a boolean control using property nodes.
01-27-2018 12:16 PM - edited 01-27-2018 12:20 PM
The "input value" only has meaning the next time the mathscript node is called and it will get whatever value is wired to it from the outside. Assuming that your mathscript node is in a loop, easiest would be to feed the new value as new x is via a shift register.
If you want more specific help, please attach a simplified example of your code.
(Also, please ignore everything that has been said earlier about value property nodes. It is completely irrelevant here and makes no sense. If you want to programatically update a control, you would use a local variable anyway)
02-05-2018 11:43 AM
Thanks for the guidance. Actually I want to control my load through a timer as shown in the picture attached like as far as the timer reaches value greater than 5, it should gets reset to 0 and start running again from the start. Is it possible?
02-05-2018 01:29 PM
We typically don't debug truncated images, but a shift register is probably what you want. Initialize it with zero, increment with each iteration, and reset back to zero as needed.
Of course your entire code would be much easier to implement in plain graphical code. No script node needed at all! Try it!
Next time, simply attach the VI instead of pictures. Thanks!
02-06-2018 02:04 AM
Thank you. I did so. I made a user defined timer using shift registers. Attached is my VI for reference. What I want to do is, that I want to press this Reset button through coding in mathscript. Like the user does not need to press the reset button, the timer automatically gets reset after meeting certain conditions. Is it possible?
Thank You.
02-06-2018
09:43 AM
- last edited on
10-05-2024
03:33 PM
by
Content Cleaner
There is no shift register, just a missing subVI. Please attach the subVI!
(Have you looked at the elapsed time express VI?)
02-06-2018 10:19 PM - edited 02-06-2018 10:34 PM
Here is that missing subVI.
I did check the Elapsed Time Express VI, but I want to reset my time according to my algorithm many times. That is why I am searching for a solution in which I write something in mathscript like "reset =1" and the reset button gets pressed. I hope you understand my point.
Thank you.
02-07-2018 12:20 AM
Your code really makes no sense at all.
The elapsed time express VI can be set to auto-reset and start over every time it elapses.
Here's something that could give you some ideas....