03-21-2018 06:48 PM
Dear friends,
Please check the attached exe file (in Zip). This executable file is very simple, give a number, then + 100000, then print out the result. E.g if x =2, then 2 + 100000 = 100002.
In the attached vi, I did this: the order of the iteration of the while loop will gives to the test.exe, then result of test.exe will be shown on labview of "standard output".
My question:1. is there a way, I can show the result just on the exe file? It's ok to open multiple exe window. e.g. in other words, lets say there are 5 iterations, then I will see 5 test.exe windows to show the different result depends on the input of the order of iteration.
2. my test.exe just needs one input. Lets say I need 2 inputs now to do x+y=c, c is output. what should i do to the "stander input"?
Thank you !!!!!
03-22-2018 05:11 AM
The way you call the exe is sequential, since you use a while loop.
If you call System Exec 5 times in parallel, the exe will be called 5 times in parallel.
If you need a while loop to do it, you need to dynamically call a reentrant VI that calls System Exec.
If you know in advance how many iterations you have and the inputs are known, you can also use a parallelized for loop (right click, configure iteration parallelism, wire iterations to P and N).
If the executable is a LabVIEW executable, there might be a problem (not sure if there is). LabVIEW executables are designed to only start one instance. You might need to add "allowmultipleinstances=True" to the ini of the executable.
Not sure if what you want is a good idea... Why not let the exe do the calculation and let LabVIEW to the displaying? Seems a lot cleaner to me. Or obviously let LabVIEW add 100000 to x, but I hope it's just a placeholder.
03-23-2018 10:56 AM
Thanks for your answer.
1. the test.exe is just a holder. The real exe will be much bigger, there are a lot of things will be displayed on the exe. That's why it's very bad to let the labview to do the display.
2. I am not talking about how to call exe parallel. I am asking, if there are 2 inputs I need to give to exe by using system exec, could you show me how to do that?
3.Let's say there are only 5 iterations.
03-25-2018 01:11 AM
@sunson29 wrote:
2. I am not talking about how to call exe parallel. I am asking, if there are 2 inputs I need to give to exe by using system exec, could you show me how to do that?
I did not get that at all from your original question.
The only way to do that is to convert the inputs to string. The exe should then parse the command line to get the strings and convert them to values. Pretty much the same as one parameter, only parsing the string is more elaborate.
If the exe is a LabVIEW exe, you might consider making it a .dll instead (you can still make an exe for users to use). The dll function can support multiple inputs and outputs. To\From string conversion would not be needed anymore.
I have no experience with LabVIEW .net assemblies, but that would also be an option. Benefit would be that the interface would be defined by the dll, so it's easier to call.
03-25-2018 06:24 PM
Thanks though
03-27-2018 01:58 AM
The most common way to send Parameters to an exe is through Parameters.
"cmd /c copy file1.txt file2.txt"
The 2 files are Parameters, 'copy' and the rest are parameters to cmd.
/Y
03-28-2018 11:59 AM
Hmm. I think you were answering my question. But I am not very follow here.
Lets say, my EXE will take x, and y. then output x+y.
My question is how to give x and y to EXE by using labview ??
I am not very following the meaning of "copy" and "file1.txt".
03-29-2018 10:10 AM
It depends...
Please tell us more about your exe.
I can't enumerate all methods for you.
03-29-2018 10:16 AM
Use an event structure - your UI should give fields for the inputs, and an 'execute' button that executes the system exec call. In your event structure, put the code that is in your while loop to call the system exec on the value change event of the execute button. Then, you will only call your exe when you press the button. Is that what you are looking for?