07-18-2017 07:50 AM
Hi all,
I have some issues with editing data. I have a program that reads a text file with data, does calculations to the data, and then displays it in a graph. There are 6 columns of data, so I want 6 different graphs. For every graph there are two things that needs to be done: calculating the mean and an offset. Now I want to edit data live, different for every graph. I want to be able to replace certain data points with NaN values. So lets say in a graph there is one data point that is abnormally high, I want to move two cursors to set the x-values, and to set an y-value, and then I want it to replace all the data points between the two x's and above the y with a NaN value. I also want this to work the other way around, so to replace values lower than a certain Y-value. I need the program to remember these alterations, and then be able to do the same for multiple points in that graph. I also need to be able to do this separately for every graph.
The problems I encounter are these:
- Remembering the alterations that are done. When I set a new area, the already altered area goes back to the original.
- Setting the cursors as coordinates. I know how to ask for the cursor coordinates with a property node, but I have trouble with passing that data.
- Doing this program for every graph. The final product will consist of approximately 30 graphs, so I was wondering if there is a way to do the above, without copying the program 30 times (or for now, 6 times).
Sorry if these questions are stupid, I'm still learning, and I get better at this every day 🙂
I've attached my program (yes, the real program now :p) I've also attached the data that I use to read.
I know this is a lot, but some tips are very welcome.
Thanks in advance!!
Solved! Go to Solution.
07-19-2017 04:13 AM
Hi all,
Yesterday I posted a rather long question. Since there are no replies yet, I'm going to do it a bit different.
So, the question is this: I want to detect peaks and valleys in an array or in a waveform graph, and then replace those peaks/ valleys, with some datapoints around them with NaN values. I've attached my VI. I've tried the peak detection VI and the waveform peak detection VI but I have a lot of trouble wiring them up. I really hope someone can help.
Thanks in advance!
07-19-2017 04:20 AM
sorry, forgot to add the text file i read from
07-19-2017 04:22 AM - edited 07-19-2017 04:27 AM
Hi lvl,
using real waveforms would make your live so much simpler:
Did you read the error message on that broken wire in the context help? It also mentioned the type mismatch between your datatype and the expected waveform!
P.S.: Next time PLEASE stick with your thread. No need to ask the same question in several places in the LabVIEW board!
07-19-2017 05:40 AM
Hi,
Thanks. Yes, I saw that I needed a waveform. I did not know how to do that. I'm learning new stuff every day.
I've managed to wire it up like you. But now I'm struggling with wiring up the waveform peak detection vi. I need to be able to extract the peaks and the valleys, and then replace them and all other data above a certain threshold (indicated by the y-cursor), with NaN values.
Sorry about the extra thread. I didn't see any harm in it.
lvl
07-19-2017 05:57 AM - edited 07-19-2017 06:06 AM
Hi lvl,
I need to be able to extract the peaks and the valleys, and then replace them and all other data above a certain threshold (indicated by the y-cursor), with NaN values.
PeakDetection gives you the position of the peaks. All you need to do is to replace the corresponding Y data in your waveform…
What have you tried? Where are you stuck?
Sorry about the extra thread. I didn't see any harm in it.
People will get annoyed by this behaviour once they recognize those multiple threads - especially when they provide help in their spare time just to notice someone else was answering the same question in a different thread!
Did you read the community guidelines?
07-19-2017 06:17 AM
Hi,
I'm stuck at the locations it gives me. They don't seem to be correct. I've attached an image to show what I mean. I also found this (http://forums.ni.com/t5/Example-Program-Drafts/Peak-Detection-and-Extraction/tac-p/3662206#M12530) example, it seems to do what I want but I haven't been able to make it in my labview version (2011). I get stuck at getting the waveform into a for loop.
Also, I'm not sure how replace the Y data with the NaN. Is it possible to do this separately for every peak? Because I need to filter some peaks, but not all of them.
Sorry again for the extra thread, I will post a link there to this thread to prevent what you described.
Thanks,
lvl
07-19-2017 06:19 AM
Sorry, I've started a new thread on this subject.
http://forums.ni.com/t5/LabVIEW/Live-editing-multiple-graphs/m-p/3662209/highlight/false#M1029229
07-19-2017 07:14 AM
oh my... I think I need some more sleep...
The location returns the index of the peak, not the x-value... right?
But if this is correct, there should only be integers right?
07-19-2017 07:17 AM - edited 07-19-2017 07:23 AM
i had made a peak detection snippet over there https://forums.ni.com/t5/Discussions-au-sujet-de-NI/Mesures-des-Pics-max-d-un-signal-provenant-d-quo...
perhaps it helps you. you have to adjust the threshold and can play with the width, and decide wether you want to find peaks or valleys.
just read the help for "Peak Detector.vi"
UPDATE: in my example i would recommend you to set the threshold to "1 - (mean+stddev)" and the type to be found to "valley"