LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

smaller array into bigger array..

Hi,
I have a problem with replacing a sub array (2D) of bigger 2D aray. I use the atached code. I want to  replace the sub -array  which starts with the 4th column and 0 row  and goes up to the size of the  sub-array itself.  My code returns me an empty array for some reason. Could some one help me out?



0 Kudos
Message 1 of 11
(4,337 Views)
Without seeing the rest of the code I'm suspecting you have a race condition, especially since you're using property nodes, which are equivalent to using local variables. Probably not initializing the "Experiment Scenario" 2D array. Or, you're initializing, but you're reading it before it's been initialized.

The function itself works just fine:




Message Edited by smercurio_fc on 06-17-2008 04:22 PM
0 Kudos
Message 2 of 11
(4,325 Views)
hmm, actually  when i use the replace  function the Experiment scenario was initialized  and written into  a long time ago. 
Download All
0 Kudos
Message 3 of 11
(4,320 Views)
one more vi is needed for my code to run
0 Kudos
Message 4 of 11
(4,317 Views)
Like I said - race condition. LabVIEW is executing the Value Read node before the rest of your code since it's out there all by its little lonesome, not dependent on anything. You should be getting the value out of your sequence frame since that's where you're setting it and changing it.

I will let others who feel like spending the time comment on the rest of your code, which really needs some constructive criticism. altenbach is really good at that. Hope he's listening.
0 Kudos
Message 5 of 11
(4,311 Views)
yeap I know my  code looks not so nice. But this is my first program in LV. I will definetelly use state machines in my next project like altenback has suggested.

I attahced wrong spekt.vi before now is the right one. sorry.




Message Edited by RSibagatullin on 06-17-2008 05:00 PM
0 Kudos
Message 6 of 11
(4,305 Views)
Same race condition.
0 Kudos
Message 7 of 11
(4,294 Views)
I am confused. Why is there a race condition?  The replace function will fire signal only after it read everything from the every input right? If so it will write to the table only after it finished reading from it. Am I right?
0 Kudos
Message 8 of 11
(4,292 Views)
No. If you were your code would work. Smiley Wink

Here's why:




Message Edited by smercurio_fc on 06-17-2008 05:45 PM
Message 9 of 11
(4,289 Views)
oh i see now.  how do you post your pictures directly into your post?


p.s. so my new VI does not have the race condition then right?





Message Edited by RSibagatullin on 06-17-2008 05:54 PM
0 Kudos
Message 10 of 11
(4,284 Views)