Add data in columns while loop

Good evening

We use an Ocean Optics HR2000 spectrometer + to record the spectra of the permanence of our laser system. For the spectrometer, we use the plug and play drivers, located here

(http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=7833BD4A31DA1274E04400144FB7D2...

Our labview program was designed to

  • Store within a well-defined time spectra of laser

The conditions required for the stored file have been

  • First column: wavelength

  • Added columns: spectrum

  • The column heading - time, after you start the program

After reviewing the forum, one of the solutions that has been applied that should use feedback nodes, as well as to transpose data later, as you can see in the attached files.

Our problem:

  • for a short term of the vi, it works fine

  • for a longer race of vi, the file is messed up (see testlong.txt): in the fifth instance of the instance/wavelength loop wrote again in the spreadsheed file

Is there something extremely stupid, we did here?

Well, I don't know quite why your program is ugly - it was complicated enough that I just re-did, according to your description.  It is here, and here's how it works:

The first loop creates ghosts (from line-become-column 2.  I use "Wait until the next multiple" so I cannot ignore the amount of time required for the calculations inside the loop.  As you can see, I use the output time of the initial function elapsed time for the line/column header.

When the loop exits, I calculate the first row/column, NaN (not a number) to stick in the first position (angle).  I had hoped it would be written as an empty entry in the text file, but it was released as "NaN".  My writing to delimited spreadsheet function is the same as yours, but I left the addition at the entrance of unwired file so that it has retained its default value False, which means that I create a new file each time.

I tested it for six and 19 seconds and it produce expected results (with a dot as decimal instead of a comma, of course).  Try it, it should do the same for you.

Bob Schor

Tags: NI Software

Similar Questions

  • storage of the data output of while loop

    Hello

    I have a data acquisition system set up to read the couple of a transducer. The output needs to be fed with an excel document, once the program stops running, or when a key is pressed.

    with the current code attached, the excel document is created, but it only shows the most recent series of data. How to make the table to store all the data coming from while loop?

    Ive only been programming with labview for two weeks, so chances are that it is something simple, but please help us in any case.

    JM

    To get what you expect, the Terminal output of table a while loop right click and select the option activate Indexing. Usually if you want to save data use queue to pass data inside the while loop to another loop/VI and perform data recording. For all that you have examples, please do a searc in LabVIEW help > find examples.

  • Sharing data between multiple while loops, competitor rates

    Hello

    I am trying to Exchange data between competitor while loops running at different speeds.  What is the recommended way to do this?    In practice, I have 12 indicators and 3 cards I would update (on screen) in the slower loop, although the data acquired and stored on disk in the fastest loop.  The image below is a simplified version of what really works my candidacy.

    I currently use local variables and shared to achieve this.  I heard however that local variables are evil because of their use of memory (data are copied instead of who passed by reference).

    Thanks for your suggestions,

    Adam

    Hi Adam,.

    Yes, here you go.

    Mike

  • How to control the rate of acquiring data in a while loop

    I'm trying to use a digital trigger to collect data on the rising and falling edge. The design is displayed as below. Now, I save the measured voltage 1 & 2 to the local variable in the while loop. Hoever, the while loop runs at a frequency of more compared to the structure of the case triggered. So I had a lot of repetitive data.  If I record data directly from structure of the case, it will be recorded as data-0-date-0 because of the ongoing case of fake wire.

    I wonder how to revise to save the measured voltage 1 & 2 at the same frequency of up/down edge triggered? Thank you! I have also attached my current version of Labview program, which takes place in time real Labview 2013.

    Mcdullna wrote:

    Thank you for the answer. Could you be more specific about the use of the shift register?

    The case of false just past the value through.  With this configuration, you agree that the data remain in the son, avoiding race conditions.  It is also more effective than the use of local variables.

  • A result of sending the data to a while loop through another loop of TCP communication

    Hi all

    I have 2 screws

    1 matching model (using the method of Grab) which is put inside a while loop. This VI works correctly and returns a string in a specific format (position and the angle of the object).

    2 TCP server who always listens to a specific port, if it receives a correct command string, it sends the string above VI - 1 (position and angle).

    The two 2 screws works if they are in separate VI. But I want to combine them into 1 single VI and I get the problem: Pattern matching doesn't work anymore (the video has only first frame then stops).

    I tried to put the two while loop in parallel or put the TCP while loop inside while loop Pattern Matching. Nothing has worked.

    Pls see my attached VI and the TCP module.

    What is the solution for requirement?

    Thank you all!

    What I would do, is be your two screws at the same time.  Given that you do not send the last result, store the result in a global variable.  Your comparison models written VI the global variable of the results of each iteration of the loop and the TCP bed module global variable results when it receives the right to order and then send it.

  • Save all the data for a while loop

    I already asked a similar question, but it is perhaps not very clear, and there are a few concepts that I did not understand.

    1. I have a keyboard to generate flow DTMF signal (I call it stream because it contains several shades that consist of a full phone number)

    2. I would like to save it as a wav file, but I guess that another format is correct and because the writing on a wav file does not support add so for this particular case, I use writing waving instead of writing to wav format

    My approach is to have a structure of queue so that I can write each iteration results in a file.

    (i) when I try to retrieve the data, there's nothing but 0.

    (II) my intention is to get 8000 samples per second (fs = 8 000) but he back up data so fast

    I have attached the file so if there is a way to solve problems, please help me.

    This vi includes many elements discussed above. There are no provisions for the intervals 'no signal '.

    Changes: Replaced with native features of LabVIEW Mathscript node. Mechanical Action to latch release button.  Cluster to array replaces Unbundle and table to build. Reshape the table to match the shape of the keyboard. Separate searches for frequencies of line and column. Note that this is easily extensible to handle the 4 x 4 keyboard. Structure of the event added. Added the stop command (but not implemented stop to the loop of the file). Added indicators for diagnostic purposes. Added FFT spectrum and graphic.

    I disabled writing to part of the file for testing.

    Lynn

  • How to record data using a while loop?

    Hello

    I created a .vi I try to use to record several channels of data. I have implemented the user must be able to record data until the "STOP" button is pressed, then the data is saved in a spreadsheet file.

    Question No. 1: How to allow the user to store an indefinite amount of data?

    If you run the .vi as is, you will see that you are only able to collect 100 points, and registration takes place during Ms. I want to collect about 5 minutes worth of data and have a sampling frequency of 1 kHz.                 Any suggestions?

    Question 2: How can I change the worksheet file extension? Let's say I want than to save it as a .csv file?

    Thanks in advance for any pointers or suggestions!

    I have not looked at your code, but only based on your description I would implement a producer/consumer to save your data.  You must acquire your data in a loop (the producer) and send to your loop of logging (the consumer) using a queue.  Yes, you must save the data, then that is acquired.  In this way, you do not have to worry about storage who knows how much data in RAM.  It's just the disk as soon as he can.

    You can save the file with whatever the desired extension.  If you want it to be a CSV file, then do the extension a .csv.

  • Table 1 d in the while loop problem

    Hello world

    I searched this problem in the forum, but seems only some positions quite didn't answer.

    I'm stuck by saving the data in a while loop.

    I have a while loop, within which there are two exits in each iteration, I want to add to a table, and then after the while loop is completed, I want to combine these two tables in a 2D array (since the release of them must be a pair in my case).

    I tried 'Build array' and 'transpose array' and 'write in spreadsheet' element set, which maintains concerns me is how simply to add the result in a 1 d table during each iteration, these 2 outputs are in digital format, which prevent to directly create a table for it.

    Any idea is appreciated,

    Thank you

    Chen Kunsheng

    Here are some other ways to insert.

    It may be useful

  • [begineer] reboot a 'while' loop reading the serial port

    Hello! I read some data from a COM port. I want to read my like this "%d S. the unit will send data continuously and depending on when I push the button run in labview, it can start to read data from the middle (%d is a four-digit number). as: 23 S 15'

    "whenever the first character of my data is not of", I need to restart playback. I read the data in a while loop. so I need to stop the while loop. From what I found on the internet, I used a case, another while loop and shift registers.

    but in some way I'm stuck inside the while loop. My VI is attached. Thanks in advance and sorry if my code is a mess!

    PS: what should I do if the bytes I get to the port is variable? use bytes to the port?

    The device sends a character at the end of the line at the end of each message?  You are currently Setup to do this by activating the stop character (currently set to end of line/10/0xA).  If this is true, then simply set the bytes to be read on the VISA to read something rediculously high.  It will stop playback when it finds this termination character.  From there, you just have to check for the correct format.  If this isn't the right format, ignore him.  Otherwise make your recording.

    I managed to clean up your code a bit on this basis.

  • Producing a XY chart in a While loop that adds a new point XY to the curve from each while the loop iteration

    I would like to plot data by using the XY graph as a Visual display. I have a While loop that creates a new point X and Y during each iteration. I need the XY graph to be in the While loop, because once the order to stop has been pressed the sis loop finished and the final graph to be displayed. The problem is that after each iteration, the XY graph display clears and watch point, compared to add the new point to the previous by a line connecting the two points. It works perfectly if I move the XY graph out of the While loop, but it only shows the XY graph at the end of the While loop. I would like to visually see the XY graph updated during the execution of the While loop. Any help would be much appreciated.

    Thank you

    You can add a data both point to a chart to a chart, you must pass the entire data group.  I would use a couple of shift registers in your loop.

  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

  • Data dependence isn't the only thing to stop while loops to run simultaneously?

    I write code to turn two stepper motors with various functions. This is my first program, so I don't know it's terrible, but I'm very interested in getting this work. I checked for the data depenecy and followed some suggestions to use local variables to solve the problem. It did not work, so now I'm trying to understand this.

    I know that all features were able to simultaneously run, but after a few changes (including put everything in a while loop to keep the program running until someone clicks the exit button), no function can currently work simultaneously.

    I'll post my code in case someone has the time to watch it (I'd really appreciate it if someone did), but I am also looking for any other problem that might be the source of the problem.

    Really, any help is greatly appreciated.

    Thanks in advance


  • How to add the unique element (inside the while loop) to itself

    I have only digital output element that is in the while loop. Its value changes in each time the loop iteration. If lets say I want to adds the values of the ten first in iterations of the loop of this variable.  How can I do that.

    See attach image for more precision.

    Thank you

    JK

    Hi Joseph,.

    THINK THE STREAM!

    As the values are stored in the son and the shift registers (and NOT in any kind of variables), you must use these fundamentals of LabVIEW:

  • Add new values to an existing 1 d table in a while loop

    Hello

    I have a while loop that collects data from a DAQ Assistant and stores it in a 1 d table. The number of rows is defined by the user. I'm trying to average of data for each iteration of the loop. So far, I'm only able to get the table to smash the previous table with the new values.

    If the number of loops = 3

    First iteration second iteration third iteration 1 d New Array [divide by loop #]

    4.97                                      4.99                                               4.98                                            14.94                       for the average]
    4.97                                      4.99                                               4.98                                            14.94
    4.96                                      4.98                                               4.97                                            14.91
    4.98                                      5.00                                               4.99                                            14.97
    4.97                                      4.99                                               4.98                                            14.94

    I would like to make it as broad as possible because the number of loops will vary depending on user input.


  • dispplaying data on the graph of waveform inside/outside while loop

    I create a vi using the random number generator, entering the number in the function(express>>arithmateic>>maths>>trig>>sine) fishing and connect the output of the function sine waveforms. Table of waveform show no problem. If I replace the with graphic waveform table, I get an error that the source type is differenct type of sink. I then put waveform chart outside loop everything hoping that tunnel would act as a table, but still I get the same error. I then put build table palette between all border and loop waveform graph which is placed outside the while loop. I get no error, but no data is displayed on the graph of a waveform. Theoretically, if I press stop I would see a distorted sine wave on the waveform graph, but this doesn't seem to be the case. I am wondering how to view data on the graph of a waveform in such cases!

    Thank you in advance for reading and help!

    See you soon

    First of all, you can take a part of the basis of LabVIEW tutorials.

    Since you need to work with a chart and it is the preferred method to display data point by point, I don't know why you try to use a chart. In any case, you cannot use all simply a table of generation because that would be just the result of the last iteration and your graph indicates it is a single point. If you activate autoindexing, then you get all the values, but not before the end of the loop. If you were to use a shift register and the build dashboard, you might place the graphic inside the loop, but then you would face performance issues that the table would grow uncontrollably.

Maybe you are looking for

  • Apple TV home sharing does not (10 Windows, iTunes 12.4.1.6)

    I have two 3rd generation Apple TV in my house and home sharing used to work perfectly on it when the contents of the copy of iTunes on my desktop Windows 10 streaming. But since than do a clean install of Windows 10 that has not worked. I search onl

  • eggs and micro sd

    Will be that the bike Z phones the first phones that are capable of both formats will be released?

  • Lenovo t61 no display, only if I connect an external monitor.

    I started using my lenovo with a second screen, but then after a few days the main screen of my laptop has stopped working, and I can use it only to the secondary monitor. If I put windows 'Add' screens and I close and open the laptop, for about 1 se

  • Startup Repair - how long is too long?

    I'm trying to startup on a Windows Vista laptop repair which starts after would have been closed normally, after what looked like a Trojan attack.  (Do not know what happened to it exactly, but my friend was not run antivirus software!) Startup Repai

  • ProBook 4530 s: keyboard

    How can I put back the 'next page' button on the keyboard, he took off to cause?