LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph zoom - data export

Hi all,

I'm using the Graph component to show the measured data (Fig. 1). Then I can zoom the area of interest, which is the cross of the two records (Fig. 2). My question is: it is possible to export the Graph zoomed data from the Fig. 2 to a file? Determination of the cross of the two records is the goal. Thank you for any help.

 

Michal

Download All
0 Kudos
Message 1 of 8
(3,111 Views)

Hi,

yes, you can zoom the graph (or create an invisible graph with the zoomed region) and obtain and save the bitmap of the graph control using GetCtrlDisplayBitmap and, e.g., SaveBitmapToJPEGFile.

 

I did not understand what you meant with 'cross of the two records', but of course you can obtain the position of the two cursor crosses using GetGraphCursor ( panel_handle, graph_control, cursor_number, &xpos_cursor, &ypos_cursor );

 

You also can obtain the indeces of the two cursors using GetGraphCursorIndex () and then save the data arrays from index 1 to index 2

0 Kudos
Message 2 of 8
(3,087 Views)

Hi Wolgang,

thank you, but this isn't what I thought. I'm recording the dependence od the voltage amplitude on the frequency and I need to know the frequency of the cross of two records/curves - red and green - as you can see on the Fig. 1 and 2. Then I zoom the point of curves crossing and I get the Fig. 2 - there is the cross of the two lines. And I want to know if I can get this data represents these two lines (Fig. 2) from the Graph to better determine the frequency of the lines crossing. Is this possible in LabWindows CVI?

0 Kudos
Message 3 of 8
(3,072 Views)

Hi Michal,

maybe this time I understand you correctly Smiley Happy You want to find the intersection between two data sets?

Why do you want to do this graphically, i.e., with zooming the graph, and not numerically?

If you want to determine the x for which f(x) = g(x) this is equivalent to solving f(x) - g(x) = 0, i.e. searching for the roots of this equation, with f(x) and g(x) being your two data sets.

So you calculate the difference of your two data sets h(x)=f(x)-g(x) and then use an algorithm to solve h(x)=0. My recommendation for this case is given here

0 Kudos
Message 4 of 8
(3,046 Views)

Hi Wolgang,

thank you, I know about the numerical solution. But it is a little bit complicated. The curves I got from measurement has usually 100 points and I connected the points in Graph via PlotLine(). So the curves crossing is made graphically and not directly from measurement - this could be done if the measurement will have 1000 or more points but this is not possible. That's why I need to get the data (points) represents the lines crossing after zooming. Now I determine the point of crossing resp. the frequency of the point crossing manually (from the Fig. 2). But if I will have the data sets of the zoomed lines, then I could use the numerical solution.

0 Kudos
Message 5 of 8
(3,041 Views)

...I still seem not to understand your problem... ("if I will have the data sets of the zoomed lines")

 

How do you produce your graph, do you use PlotXY, PlotWaveform...? If so, you have the data arrays...

you also can use GetPlotAttribute (, , , ATTR_PLOT_XDATA, ); and GetPlotAttribute (, , , ATTR_PLOT_YDATA, ); to copy the data of the plot into a pre-allocated buffer.

0 Kudos
Message 6 of 8
(3,037 Views)

Hi Michal,

 

If you simply want a larger data set of points that is comprised from the original 100 measured points with additional points (that represent the straight line between each two measured points) you can do this in your code quite simply like so:

 

// in this example we add 10 new data points between each pair of samples
double measuredData[100]; double interpulatedData[990]; // 10 indices * 99 sample-pairs // Get the data... for (int i = 0; i < 99; ++i) {
// using Ramp() from CVI's Advanced Analysis Library Ramp (10, measuredData[i], measuredData[i+1], &interpulatedData[i*10]); }

 

0 Kudos
Message 7 of 8
(3,022 Views)

2Wolgang: I tried the GetGraphCursor() function and it seems that it could be used for my purpose. But the accuracy of frequency determination (on the X axis) depends on the cursor position.

I'm using PlotLine to draw the curves. Which means that the curves crossing is a results of the interpolation between two measured points.

 

2daniel15: This Ramp function seems very helpful!!!

 

Thank you both!!!

0 Kudos
Message 8 of 8
(2,998 Views)