01-27-2016 03:49 PM
Very, very new to LabView programming, so bear with me...
My program is taking a data array of frequency points, passing it through a formula node that calculates a value for a limit line based on the frequency, then plotting this limit line array as well as the actual data array gathered by the instrument as functions of the frequency.
My problem is that I want the limit line to only be plotted from frequency values of 0.5 to 20, but the frequency array and actual data array contain many points outside this range, both lower than 0.5 and above 20. I still want to plot all of the actual data values...
My initial thought was to introduce a conditional statement in the formula node to only use the equation to calculate the limit line values when (X>=0.5 && X<=20). However, what would I use as my "else" case for this conditional? I don't want to simply set them to 0 if they fall outside the range, because I don't want awkward looking lines on the plot jump straight from 0 to the actual value at X=0.5 or in the opposite direction at X=20.
Right now, all of these arrays (frequency, calculated limit line values, actual data) are each an element of the "MainDataArray" (an array of arrays). Will I have to make a new array to contain the subset of frequency values being used by the limit line values in order to get it to plot correctly, or is there some other way that I can simply "cut off" plotting for the limit line values at certain frequency values (x-values)?
Solved! Go to Solution.
01-27-2016 03:56 PM - edited 01-27-2016 04:02 PM
Why can't you disable auto-scaling and just set your x-axis on the graph to start and end at those limits? Am I missing something?
If you share your code, it may be easier to help if the above isn't the solution.
Edit: Nevermind I see what you're saying. Set the elements of the limit line to NaN if you don't want to display them.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
01-27-2016 05:59 PM - edited 01-27-2016 06:12 PM
Here's an example for case #4:
Please show us your code with some typical data.
01-28-2016 07:43 AM
How would I assign NaN to the array values using the formula node, or is that not possible?
01-28-2016 11:16 AM
Why would you need a formula node?
01-28-2016 11:22 AM
Right now, the equation in one of my formula nodes is:
Z=(X>=0.5 && X<5)?1.11111*X-26.5556: (X>=5 && X<10)?0.4*X-23: (X>=10 && X<=18)?0.375*X-22.75;
But this is giving a "missing colon" error..... how do I make Z = NaN for values where (X < 0.5 && X > 20)?
01-28-2016 11:35 AM - edited 01-28-2016 11:54 AM
Formula Nodes are slow. See here.
If you have to use a formula node, which you don't, you can do NaN as a variable like this:
(You forgot your Else case at the end of the formula, that's why you have an error.)
Without the formula node, you could do it like this:
You can't do floating point in to a case structure, but if you multiply by a factor of 10 for the precision you need, you can use the integer values for the case structure. Default to NaN, so when it is out of all the other ranges, you get NaN.
One of the other cases FYI:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'