Jump to content

Mikkel

Members
  • Posts

    74
  • Joined

  • Last visited

Posts posted by Mikkel

  1. QUOTE(TiT @ Mar 6 2007, 08:09 AM)

    Hi,

    All this remind me this thread on NI forum : http://forums.ni.com/ni/board/message?board.id=features&message.id=7#M7' target="_blank">http://forums.ni.com/ni/board/message?boar...message.id=7#M7

    "For loop with a break" don't exist in LabVIEW... the subject has been discussed. Do we really need these knowing that we have a while loop ?

    I think Michael's post answers the question.

    I would love for LabVIEW to support a 'break' operation in for loops (the lack of this feature is actually one of the (few) things that annoys me, when coding in LabVIEW).

    This way, you would elegantly be able to iterate through an array until some condition is met, and then exit the loop.

    Yes, I know this can be achieved by using a while loop, but not without first getting the array size, and making the 'compare with i' logic inside the while loop (and enbedding the while loop in a case, to handle if the array is empty).

    -Mikkel :)

  2. QUOTE(frentzen @ Mar 5 2007, 03:15 PM)

    Hi,

    Thanks for your answears. i just forgot a little thing to mention. I want to run the vi continously with file path integrated in the vi.

    the xml-file gets new data every minute and the vi should always get the new data.

    thank you so far,

    thomas

    Well, then it would be natural to use a 'While Loop' around your code. If you want the path to be constand, you can use a 'Path Constant' on your diagram. Once a second (use 'Wait (ms)') you could check if the datafile's time/date has changed, and reread the file if it has. More information about loops, delays, and file operations can be found in the examples installed along with LabVIEW (Help/Find Examples...).

    -Mikkel :)

  3. QUOTE(frentzen @ Mar 5 2007, 01:21 PM)

    Hi,

    i want to run this vi continuously , but i get the following mistake "The data type of the Variant is not compatible with the data type, which is connected with the entrance". has anybody a sollution?

    i attached the vi and the xml-file i want to read.

    Thanks, Thomas

    In stead of using a script to parse your XML file, you could try to parse the XML data (after reading it as a text file) by using the LabVIEW VIs "ParseXMLFragments.vi", "FindFirstTag.vi", "FindMatchingCloseTag.vi", all located in \vi.lib\Utility\xml.llb.

    This would solve the variant related problems, as well as being more clean code.

    -Mikkel :)

  4. QUOTE(zero-tolerance @ Mar 1 2007, 11:48 AM)

    Sorry guys but I need some more help.

    Last night I was trying to do 2 things that I couldn't accomplish AGAIN:

    1) From all the numbers that are generated (as above) there are some duplicates. i.e. the integer "0" is repeated a few times etc. And I am trying to remove them since I only need 1 copy of every digit. The problem I am facing here is that the duplicate elements are not next to each other inside the array, for example number appears on index 1 of the array and then the same number on index 30 again etc.

    2) Final problem is the averaging. Out of all the numbers I have on the array (i.e. the big list of numbers generated) if I input an array with size 4000, it will go through the list of numbers and the size of the same array on the output should be 3920 on the output. So the last 80 elements of the array are discarded. So, what I am basically trying to do is resize the input array based on the array sizes that are available on the table (i.e. the big list of numbers generated). So the input array was 4000 and the same size is also available on the table, but the next size smaller that 4000 that is available on the table is 3920, so thats the size the input array should choose to take on the output.

    The above I couln't accomplish all night yesterday, so again any help is appriciated.

    Thank you in advanced.

    1) If the order of the elements in the array is not important, you can quite easily find and remove repeated values by first sorting the array ('Sort 1D Array' function).

    2) Uhh. Lost me there :wacko:

    -Mikkel :)

  5. QUOTE(Rimmergogo @ Mar 1 2007, 01:44 PM)

    I fixed the problem already by substracting 4294967296 from the horizontal value wen it is above 2000. but still the bug remains unclarified.

    Since the value you get from 'Y Scale.Bounds:Width' is unsigned, the output type of following addition and the top subtract operation (Horizontal) will be unsigned.

    Changing the output type from the addition to signed long (with a 'To Long Integer' conversion) solves the problem.

    -Mikkel :)

  6. QUOTE(Joost van Hamond @ Feb 27 2007, 12:14 PM)

    When I read your question I went ahead and made the attached llb (LV 8.0) just for the fun of it.

    It implements the screen capture the ugly clipboard way, but seems to work.

    The 'App.Get Image' part was made by yen, and taken from this thread:

    http://forums.lavag.org/index.php?showtopic=4281

    If you want to check for specific data on a web page, it might be more productive and a lot more elegant to retrieve the HTML for the page, and then parse this string. 'Data socket read' can be used for this purpose, if you provide the URL as 'connection in' (if you don't want to implement the HTML transfer yourself using the TCPIP primitives).

    -Mikkel :)

    http://forums.lavag.org/index.php?act=attach&type=post&id=5058

    Edit: Dooh! Just re-read your post, and saw that you wrote LV 7.0. Oh, well time to upgrade! ;)

  7. QUOTE(John Rouse @ Feb 27 2007, 06:35 PM)

    Here is a tip

    Put that puppy in a shift register (while loop) and use the match string function with the period '.' delimeter

    to parse out the values then auto index em out as an array.

    Attach the comparison operator <0 to the index output of the match string function to tell the loop to stop parsing.

    This is the essense of parsing strings.

    Unfortunately I don't have an example.

    I think I would prefer using the 'Scan from String' function with format string "{ %d.%d.%d" - but it's a matter of taste...

    -Mikkel :)

  8. QUOTE(eaolson @ Feb 22 2007, 07:47 PM)

    He's talking about collecting 16 channels of data at 1kHz for 200 hrs. By my quick calculation, that would be an 87 GB data file. I'm sure that's not impossible, but it probably opens up entirely new avenues of challenges. Does TDMS perform any compression on the data it streams to disk?

    As described in post #2, you could make several datafiles and delete older files when they become obsolete.

    This would solve the 87 GB problem...

    -Mikkel :)

  9. Fist off, I think you need to do some modifications to your loop. For a start you could move the initialization of the serial port outside the loop, and look into using a termination char, so you read data line by line in stead of reading all the bytes present in the serial input buffer.

    Once you have taken care of this, parsing of the data should be a lot easier.

    -Mikkel :)

  10. QUOTE(EJW @ Feb 19 2007, 07:49 PM)

    I am converting an old LabWindows 3 program to LabView 8.2 (don't ask). I have basically started from scratch as there are

    some new things our test lab would like the program to do.

    The one that i am sorta stuck on, although have thought of a couple methods, is buffering data.

    We read 16 AI channels at a rate of 1KHz. Based on the current cycle the program is in, it writes a single (averaged) data point from each channel to a measurement file.

    What I have been tasked to do is when the test fails (destructive testing of a part) which is typically after 200 hours or more of testing, they would like the last 5 minutes of full rate (1KHz data, 300K data points per channel essentially) written to a separate file so that they can see exactly how the test part failed.

    Any ideas on how to store 16 channels worth of data for that many data points/ time frame?

    My original idea was to use shift registers and initalize each one with 300K elements and then use the rotate 1D array and replace array subset functions. Maybe this is the best way, maybe not.. I could sure use some input!

    Thanks!

    I think I would stream all the readings into a file - maybe one file pr. hour, and keep deleting the oldest file, so you have at least the last two present on disk. After the test ends, process the last file(s), extracting the last 5 mins. of data.

    -Mikkel :)

  11. Hi Rolf,

    only half a success. For some reason the property Application.ParentWindowForDialogs always returns zero.

    The effect on my program is that when running the VI the first time, the file dialog window ist on top, like it should. But running the VI the second time, the file dialog window is again buried underneath all LV windows.

    Any ideas what is wrong here?

    Thanks,

    Guenther

    I don't know what you are doing wrong, but I have attached a VI that finds the callers window handle the ugly way :)

    Download File:post-5175-1170935219.vi

    -Mikkel

  12. I think a better solution is to modify the string already in memory (output from the 'Read Lines From File.vi') and rewrite the complete file. The way you are doing it now is bound to incorrectly overwrite data in the start of the file, leaving an incomplete dataset after the header.

    -Mikkel :)

  13. Maybe I don't understand what you are trying to do but:

    Why are you using variants at all? If you flatten your clusters directly to string, and let your queues contain strings, doesn't this solve the problem? (If you flatten a cluster to string it does not contain element names, but if you flatten the cluster variant it will, at least in LV8.0).

    -Mikkel :)

  14. I can't see a way to programmatically size a string indicator and/or the window size to match its contents, such that it mimics the behaviour of the 'message' indicator of the One Button Dialog box. Anybody out there to help or to hint?

    You can look at the "Three Button Dialog.vi" to get some inspiration - it's located here:

    C:\Program Files\National Instruments\LabVIEW 8.0\vi.lib\Utility\error.llb\Three Button Dialog.vi

    -Mikkel :)

  15. As far as I can see (count!) you have 24 chars in your read buffer and 25 in the search pattern, thats why -1 is returned.

    The reason this might work when you trace it, is most likely that your VISA read VI gets to read more data, as execution is delayed.

    I don't think it's a problem with the string compare function.

    -Mikkel :)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.