LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to array urgent~!

As Bill mentionned (and shown nicely in his last post  😉 ), you MUST maintain the appropriate dataflow.  You can accomplish this using by wiring the error cluster appropriately.

Otherwise you'll be saving a blank graph (or previous graph).

I modified your image (not the code), which I attach below.  One comment is when you have two looks basically doing the same thing, try to combine them into a single loop.

 

 

Also note... (I just saw it after modifying and posting the image):  your array is already a string array.  You do not need to convert it, unless you want to modify it's formatting.  You could wire directly to the "Write to spreadsheet file.vi" (you can wire numerics directly to it also). 🙂

Message Edited by JoeLabView on 09-08-2007 10:08 AM

0 Kudos
Message 31 of 51
(1,146 Views)

Hey guys!

Dataflow is important but your error cluster does not guaratee that the xy graph contains fresh data! You only guarantee that the xy express vi executed before the image, but it does not guarantee that the graph updates before the image is taken. (most likely it will be OK, but there is no guarantee!)

      ^ first                     ^later          ^after first, but no necessarily after "later".

This is one of those cases where a two-frame flat sequence is needed. Also don't forget that xy graphs take complex data directly, so here's a quick draft with a lot of missing wires that should point you in the right direction.

Message Edited by altenbach on 09-08-2007 08:13 AM

Message 32 of 51
(1,136 Views)
Great point and, for me at least, a lesson learned.
0 Kudos
Message 33 of 51
(1,122 Views)
The quickest fix in your case would be to place a single frame sequence around the graph terminal and wire the error cluster across it.
Message 34 of 51
(1,128 Views)

Nice job Altenbach 😄

 

0 Kudos
Message 35 of 51
(1,118 Views)
wow wow...thanks alot...!!!
i got question again,
1st, the table izit will fit to my front panel list? do i need to make any setting for it? I wil show to you the pic.
2nd,
Altenbach, do my sequence structure correct?
3rd, the data what format should I save as? .txt?

really, thanks lot to you all guys!! help me alot!!!!



Download All
0 Kudos
Message 36 of 51
(1,112 Views)
  1. If you worry that the table indicator is not big enough, right-click it and show the vertical scrollbar.
  2. No. The single frame sequence should go around the graph terminal.
  3. .txt is not a data format, just a file extension that tells windows to open the file with notepad if you double-click it (or whatever application is configured to handle files ending in .txt. So, if you save your data in human readdable ASCII format, e.g. using "write to spreadsheet file", you can give it a .txt extension if you want.
Message 37 of 51
(1,106 Views)
More details on point 2:
 
The image shows what I have in mind. In your version the sequence frame can execute in parallel to the xy graph update, leaving you with the same race condition as before. If you place the frame around the graph terminal, the sequence frame cannot finish until the terminal has received the data. Only at that point the error cluster produces an output so the following code can execute. Dataflow dictates that a structure cannot produce any output until everything in it has finished. The "get Image" must wait until the data is available on the error cluster, which can only happen after everything in the sequence frame is done.
 
 
 
In reality things could get more complicated, because graph updates are not synchronous by default. I would expect that the "get image" method forces a redraw before taking the Image. I am not sure about that. Maybe there are other checks in place to ensure that the image data is current. Only the developers know for sure. 🙂
 
I still don't know why you use the "build xy graph" express VI since you have simple data (not dynamic data, etc.) and don't need to keep a history. All you really need to keep is the terminal of the xy graph (labeled VI Graph) and wire it as I showed earlier.Your version just clutters the diagram and adds unneeded complexity detouring via dynamic data for no reason..
 
 

Message Edited by altenbach on 09-08-2007 11:23 PM

Message 38 of 51
(1,105 Views)

ok, the data that i save, is in what format? what program should I use to read the data ?
0 Kudos
Message 39 of 51
(1,099 Views)
You should not format an array of strings with %d, use %s instead in the "array to spreadsheet string".
 
 
Later just read it back using "read characters from file" and convert it back to your array, now using "spreadsheet string to array" with %s as format and a 2D array of strings as type. If your string array elements don't contain tab characters (and they should not in this case), you should be all set. 🙂
(Newer versions of LabVIEW support arrays of strings directly via a polymorphic selector of " the spreadheet I/O functions. This would make things a bit simpler.)

Message Edited by altenbach on 09-09-2007 12:11 AM

Message 40 of 51
(1,098 Views)