LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variable value in for loop starts with last entry from previous run

Solved!
Go to solution
Is there any way to control the execution of the commands (aside from from using a flat sequence?)  The code I attached is only part of a larger program...the wires would start going all over the place.  Just curious, but I will try to rewire it as you described.
0 Kudos
Message 11 of 18
(1,100 Views)

I've attached a VI with all the local variables gone.  I think i preserved functionality, but it's hard to say.  Anyway, back to the array issue.  I think what you are looking for is just sending the result to an indexed array, like I have done.

 

In terms of controlling execution, you can do so simply by wiring things together.  A piece of code can not execute until all of the lines coming into it are ready.  Therefore, it has to wait for the part before it before it can execute.

Message Edited by elset191 on 05-04-2009 03:35 PM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 12 of 18
(1,097 Views)

First of all, you should clean up the code, it is exceedingly complicated and convoluted. You also have tons of mismatched datatypes.

 

The following would be a rough draft with very similar functionality (please verify, it's not fully debugged). You don't need all that code!

 

 

(Sorry, I no longer have access to LabVIEW 7.1, so a picture is all you get ;))

Message Edited by altenbach on 05-04-2009 02:36 PM
0 Kudos
Message 13 of 18
(1,081 Views)
Hi Tim, I couldn't open your program becuase I'm running version 7.1.  I'll try to see if the code in the picture does what I need...not sure it does exactly, but looks close.
0 Kudos
Message 14 of 18
(1,076 Views)
Solution
Accepted by GMik

GMik,

 

Based on your posts and vi, I believe this is what you are trying to do:

1 - Healing pattern is randomly generated integer, 0 - 2

2 - Contents of healing array vary based on the healing pattern.

    Healing Pattern = 0, Healing31 array contains randomly generated 0's and 1's

    Healing Pattern = 1, Healing31 array contains eight 0's, followed by eight 1's

    Healing Pattern = 2, Healing31 array contains four 0's, four 1's, four 2's, four 3's

3 - Force21 array contains randomly generated 0's, 1's, 2's or 3's

 

If this is correct, then here is one way to do it.  I don't have LV7 loaded, so a picture will have to do.  For the sake of documentation I have shown what is in the other cases of the case statement.

Message Edited by Wayne.C on 05-05-2009 10:11 AM
0 Kudos
Message 15 of 18
(1,044 Views)

Hi GMik,

 

I converted the original VI posted for you to 7.1.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 16 of 18
(1,035 Views)
Thanks, this is almost exactly what I was looking for. 1 - Healing Pattern is randomly generated 0-2 2 - Healing Pattern = 0, Healing31 is either all 0s or either all1s. whether they are 0s or 1s though, that part is ranomly generated Healing Pattern = 1, Healing 31 is half 0s followed by half 1s. (I was initially thinking it would be either half 0s then half 1s or it could be half 1s then half 2s, again, the initial number is randomly selected...i kept it simpler for now) Healing Pattern = 2, Healing31 is 1/4th 0s, then 1/4th 1s, 1/4th 2s, and 1/4th 3s 3 - Force21, you're right, random numebrs 0-3 Thanks for the help, this has been great, and has shown me new tools in labview I haven't used. Thank you guys for the help, I will try the different solutions, and take a look at vi that was just posted in labview7 also and see. Thanks!
0 Kudos
Message 17 of 18
(1,023 Views)
I tried the solutions posted and with a tiny tweaking they worked well, thanks guys!
0 Kudos
Message 18 of 18
(1,004 Views)