08-26-2011 01:18 AM
requirement is to plot a graph with voltage in x-axis and counts in y-axis. I have formed a 2-d array and fed as input to graph.
Could you please guide me in changing the axes accordingly.
08-26-2011 01:44 AM
Hi Kriti,
your JPG seems to hide a real RubeGoldberg: first you convert your file content to a 2D array, but just to use the size information to convert again to vectors. Doh...
- You can change axes by right-clicking them and set their properties.
- Do you need a histogram plot ("counts in y-axis")? Do you get "counts" from the file?
- Have you tried a "real" XY-graph instead of the waveform graph?
- Attach a real VI instead of a JPG to get detailed help.
08-26-2011 02:18 AM
Thanks for the response
Ok, let me be more clear in my requirement.
sample data i want to plot:
Vol Counts
16 16.25
22 63.25
I have attached the vi now :womanhappy: and the graph displays 2 plots ( red and white). The white plot is the 1st col in the aray built ( vol value) and i am not sure what is the red plot and i want to change the graph properties in such a way that vol values are on X-axis and counts values are on Y-axis.
i am beginner in using labview, kindly bear with me... :womanwink:
08-26-2011 02:42 AM - edited 08-26-2011 02:46 AM
Hi Kriti,
Your code is doing the following:
1) Opening a file to read.
2) Finding the number of lines there are, in a very complicated way.
3) Reading each line, and finding before and after matches with tab as a delimiter: (But your code does not have a tab delimiter, so it is producing a logical error)
4) Ouputting these into a graph, which is working as expected, except for the above error.
The error in 3 is because between your values you have spaces, and not tabs. Tabs are represented by \t, so you'll have to give that in your data file.
To see the error, expand your indicator size (the indicator coming out of the "before match" of regular expression. It is taking both values and not the first value like you expect.)
Regards,
08-26-2011 02:46 AM
08-26-2011 02:56 AM
GerdW's VI does a good job in explaining the correct way to get your output. However, it uses a predefined input instead of a file. Make sure you use tabs correctly in the file. Between each column you must use the tab key. Vol<tab>Counts, 16<tab>16.25, and so on). That, combined with the corrected VI shown by GerdW should solve your problem completely.
Thanks
Prashanth N
National Instruments R&D
08-26-2011 07:44 AM
Thanks GerdW, that was very useful... :womanvery-happy:
brushing up on the charts, graphs and XY....
08-26-2011 07:45 AM
Thanks for the suggestions Prashanth :womanhappy: indeed useful.... i have taken care of the input data format..