LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Grab data from files and plot on same graph

Hello

I have written some code where I ask the user how many files he or she wants to open. These files contain data in 2D format and i want to output them on the same plot. I have tried bundling them into clusters and outputting them but it hasnt worked. Can someone look at the code and suggest some way around this. Thanks
0 Kudos
Message 1 of 5
(2,712 Views)
1... If the user has to enter the paths into an array anyway, don't ask him/her to count how many there are - just wire the array into the FOR loop and let the loop figure it out for you.

2... No need in indexing the array based on I - wire the array into the loop and let it pick out one on each iteration. That's what auto-indexing is for.

3... I'm not sure what your code is trying to do with the data from the file. You pick out column 0 and then pick out column 1 and then bundle those. Is that the X and Y data for a plot? (You don't have a plot on your panel, so it's hard to tell).

If #3 is correct, then you're almost there. You want to build an array - use the bundle as input #0, and the array from the left Shift Reg as input #1. The output goes to the right Shift Reg. Think about what this is doing - each X|Y bundle is a plot - you append one plot to the array each time thru the loop (each file).

Whan that's wired correctly, then pop-up on the left Shift Reg terminal and CREATE CONSTANT. That will create an empty array of plots to be used as the starting point. Then wire the right side Shift Reg out to an X-Y graph.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 5
(2,704 Views)
Hi

Thanks for your reply. Im not sure I understand your first and second point. I want the physical size of the array of file paths to change dynamically coz I do not know before hand how many plots I want to see. Also I want to be able to change the existing file path once it is running incase I make a mistake of choosing the wrong file. Is there a better way? Im not sure I understood what you meant.

I am trying to output it to a XY graph. I have built the array but when I try to wire it to the XY graph it does not work. I had done it like you had said b4 i put this post but I did not understand why.
Thanks
0 Kudos
Message 3 of 5
(2,689 Views)
oops forgot the file
0 Kudos
Message 4 of 5
(2,686 Views)
I want the physical size of the array of file paths to change dynamically coz I do not know before hand how many plots I want to see.


I see.
Well, If you need to enter, say, 10 files in the path array, and only plot the first, say, 5 of them, then what you are doing is sensible.

But be aware that if you wire the array directly through the FOR loop, it will execute one loop for each file, and you don't have to use an INDEX operation, or the property node, or ask the user how many files he just entered.

I had done it like you had said


The file you attached was identical to the first file - I nsee no evidence that you changed anything.


Try my attached VI as a starting point.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 5
(2,682 Views)