04-03-2013 04:21 AM
Hello,
I want to make a small program which will reduce the amount of time to proceed with measurement data. I get the data in the .dat format, where every file consist of measurement spectrum with one X and one Y column. The problem is that I did 4 experiments (X column is same for each experiment) with 15 measurements file each, and more than 500 measurement points in each file. I would like to do some simple manipulation with that data and copy that information to one file with same X column and multiple Y columns, so later I could use this data with Origin or Excel (doing this manually is frustrating and time consuming).
In the beginning my program reads background information with X and Y(b), and after I open spreadsheet to insert the X and Y(n) data. (doing some simple manipulation, like dividing Y(n)/Y(b), program show on one graph current data and on another graph multiple datas, which are stored and need to be exported to .txt, .dat or directly to Excel (which is more preferable)). I am OK with opening several data files, but not OK with copy/pasting to file and manipulating all that data manually, that is my motivation to make this program.
The example which is attached can do all this (except for writing to file). It plots several graphs on one XY graph via use of cluster and shift registers. It is even possible to extract all that data in Excel from the graphs, but the real problems comes with data being always added because of the loop. This gives a lot of empty and later repeated data. I am lacking to get rid of this. I've also attached several measurement files: 1 background and 3 measurements.
P.S. I tried to save time by making this program, but now I've spent more time than if I did this manually 🙂
Solved! Go to Solution.
04-03-2013 04:36 AM
Your program makes absolutely no sense. What's the purpose of the sequence structure? It just sits there, running once in parallel to the the while loop. Most likely you read from local variables before other parts of the program had a chance to write valid data to them.
In the while loop, you have a timeout case that appends the same data over and over, every 50ms. Why?
Your "switch until released" mechanical actions are ill advised. Use latch actions and remove the case structures inside the event frames.
Try to rethink the problem once mode, then solve the problem with 20% of your current code. See how far you get.
04-03-2013 08:19 AM
Thank you.
After revising help on Event structure and your coments could fix it to smaller code.
Although there are some minor problems left, such as additional XY columns for background (begining of the code) and after pushing the Stop button.
Is there are a method to save it with one X and several Y columns? It is possible to save data directly from the graph (right click on the graph), but the data I receive has X column for every plot.
Thank you one more time for giving me some push to solve this problem
04-03-2013 04:54 PM - edited 04-03-2013 06:22 PM
A couple of pointers:
Here is a quick draft (LV 2011). It is not tested, so modify as needed.
04-03-2013 09:43 PM
Thank you, this is much more simplier VI.
Never knew that complex arrays could be used for XY graphing. Although mine LV experience is not so big.
I've modiefied the program. Just separated the Stop and Save cases, because if you Stop the VI it will ask to save the data,
and if you Save the data and then Stop it will add last Y column one more time.
04-07-2013 08:07 AM
Yes, you definitely need to build the array of xy plots inside the appropriate event case. the currently very simple implementation does not deal well with randon user inputs. You might even add an event case to remove existong plots.