11-20-2008 11:32 AM
Guys,
The idea behind the attached code is quite simple.
I have a 2D parent array. First, I print a subset of this array into a table control (based on a sensor selection). Now, I want edit the numbers in the table. I need the changes to be reflected in the table and the parent 2D array. (In simple terms, this is like replacing the the edited array subset into the parent 2D array)
The problem is when I change(edit) any entry in the table, the entry changes back to its original value. The change doesnt seem to be reflecting on the parent 2D array and the table. .
Can anyone tell me where the problem is?
Thanks
Ravi
Solved! Go to Solution.
11-20-2008 11:48 AM
Confession up front: I did not look at your code.
What I suggest you do is watch the code in execution-highlighting mode (turn on the light bulb) and watch the data flow. It sounds like the data is being copied from you called the parent to the other repedly.
"The Light bulb reveals all"
Ben
11-20-2008 12:25 PM
Thanks for the advice Ben. It was really helpful. I dint knew the option before.
The problem is solved via introducing an additional integer variable and new case structure.
Cheers.
11-20-2008 12:46 PM
Ravi,
I would suggest trying to reduce your use of local variables as much as possible. When passing a value from one loop iteration to another, shift registers are the preferred method. If you use a shift register you should be able to eliminate all of the 'output array' local variables. Local variables are useful in some cases, but they make it very easy for a race condition to happen.
Chris M.
11-20-2008 12:51 PM - edited 11-20-2008 12:52 PM
I agree with Chris, here's an idea (of whatI think your code does):
The case structure in your code was unnecessary, all the cases were the same so I removed them.
The sequence structure was unnecessary.
Ton
11-20-2008 01:00 PM
Thanks for the advice Chris and Ton,
The code now looks neat and does exaclty what I wanted.
Cheers
11-20-2008 02:02 PM
Please don't check your thank you message as the solution to your question. Mark the actual message that was the most help to you.
http://forums.ni.com/ni/board/message?board.id=130&thread.id=5401