01-24-2011 09:46 AM
Hello and thanks for reading.
I have a c++ program that I use to list CCD-cameras available on computers in a LAN. For this I have constructed a VI, lets call it List.VI, that I provide a string containing the computer name. The return is a list of the cameras available on the computer specified.
Now I want to use this VI to scan several computers and store the return in an array where each element represents the return from one computer. I don't know how many computers I'm going to use so the size of the return is specified by the number of elements in the input array. The VI I'm supplying isn't functional on other computers but it will give you an idea on what I'm aiming for.
I have incorporated my List.VI in a for loop and it generates 3 return messages (in my example code). My problem is the Replace Array Subset function. It requires an text control array (which I call dummy array) in which I'm suppose to replace one element which works fine for one loop. But when the loop iterates and the second return from List.VI is placed in the second element of the dummy array but the first element is lost. I need to find a way of either stacking the return elements or somehow update the already returned elements in the dummy array before filling the next. And I can't do it with any of the functions available. Are there any other functions of program designs that can help me?
Any tips would be much appreciated.
Best regards
/Mikael
Solved! Go to Solution.
01-24-2011 09:52 AM - edited 01-24-2011 09:55 AM
You have some misconceptions here. Why so complicated? All you need is an autoindexing FOR loop.
(In the more general case, you would need to built your array in a shift register, but not here. You also cannot replace an element that does not exist)
01-25-2011 01:38 AM
Thank you!
I didn't know about autoindexing for loops.
01-25-2011 09:58 AM
Thanks again for the quick response and the nice answer, but I have another question.
Autoindexing FOR loops executes sequentially, but what if I want to run an user defined number of calculations in parallel? Or more specific; if I want to use parallel instances of system exec.vi? Is there a structure that does this?
Best regards
/Mikael
01-25-2011 10:09 AM
You can use VI server with Dont wait for completion to start parallell processess. I take it you can use that to start 10 SystemExec.vi. 🙂
/Y
01-25-2011 10:42 AM - edited 01-25-2011 10:42 AM
@Mikael.Peterson wrote:
Autoindexing FOR loops executes sequentially, but what if I want to run an user defined number of calculations in parallel?
In newer labview versions, you can enable parallelism if there is no data dependency between loop iterations. This allows several iterations of the for loop to execute concurrently.
01-26-2011 01:39 AM
Thank you! Thats exactly what I wanted.