05-08-2015 12:25 PM
@zqz51911 wrote:
Hi Knight of NI, I still have some problems, sorry to bother you again.
The problem is why my vi can only output in array 2(in the loop) while the vi running. If I want to output in array 1(out of the loop), I need to click the stop button every time.
Another problem is the reset button, I want a reset all the value to zero when I press this button, however it did not work.
The last problem is when I run the vi, when the first time I press the “toggle” ,in the “Frequency” and “break” indicator, there always some random number come out unless I press three times to finish a cycle the number will remain normal.
Thanks
r-click the event structure and Add event, then add a Reset button:Value change and move the reset-code into that one. The event structure is basically a interrupt-driven case structure. That's also how you avoid having multiple event structure, just add events to the same one. (In the rare case where you actually need multiple event structures they should be in separate while loops)
/Y
05-08-2015 12:33 PM
zqz51911 wrote:
While you are at it, learn about dataflow. From the placement of the local variables on the bottom right, it seems you are epexting them to go to zero when the program completes. However, since there is no data dependency, they will execute in parallel to your main loop when the program starts and you could create race conditions.
05-08-2015 12:42 PM
thanks, I am really new to labview
05-08-2015 03:00 PM
another question, I want to convert my output from vertical 1d array to 2d array spreedsheet table, how to achieve that fuction?
05-08-2015 05:00 PM
Are the strings always the same and in the same order? (If not, the problem will be much more complicated.)
If so, you can extract the strings once and build the header row as a 1D array of strings
Then autoindex on the array of cluster, unbundle the numbers, build them into an array and format them into an array of strings. Autoindexing on the output tunnel will give you the 2D array, one row per array element.
Add the header row to the top.
05-08-2015 05:11 PM
the order is the same , I try to use unbundle cluster to achive this funchtion , however the output 2d array give me vertical result ,i need the flat one
05-08-2015 05:13 PM
Reshape both columns.
05-10-2015 10:56 AM
at the beginning of my vi running, there always some big random number come out, where is the problem come from ?
05-10-2015 11:07 AM - edited 05-10-2015 11:19 AM
You don't initialize the shift registers, so they will contain whatever data was in there the last time you ran the VI in the same edit session. The data is not random, but will tell you exactly how long you waited before running it again. The first time you run it, it will contain the default time, which is January 1, 1904, giving you a very, very big difference.
You need to initialzie the shift registers!
05-10-2015 11:13 AM
thanks a lot
it works