# LabVIEW

cancel
Showing results for
Did you mean:

## Multiple waveforms from a 2-D array

Hi,

Im trying to print multiple waveforms from a 2-D array of data. Im currently able to show all the waveforms in one chart, but, i would like to switch between waveforms with the help of a numeric control of some sort.

I have attached the VI, the "Cluster" and "Waveform Chart 2" are the ones im trying to fix. I tried converting the data to a bundle and use it somehow, didnt work that way.

Thank you,

Message 1 of 11
(2,797 Views)

## Re: Multiple waveforms from a 2-D array

Is your data by rows or columns? Why don't you just have an Index Array right at the 2D array? Why all the jumps through matrices.

Your code can use improvements. Your mechanics for creating the strings for the channel selection can be greatly simplified (and even eliminates the local variables):

Even in your case you did not need to use local variables. A simple wire would have done the job just as well. Do not use local variable to get data from one sequence frame to another. For that matter, your sequence frame isn't even necessary.

Also, the Stop primitive is pointless. Your loop is already stopping by means of the button. Are you trying to make doubly sure it stops?

Message 2 of 11
(2,791 Views)

## Re: Multiple waveforms from a 2-D array

Smercurio_fc,

Thank for the suggestion, i will simplify my code...

My data goes like this:

Channel->           101    102  103...

Current

x         y     z

x1        y1   z1

I will need separate plots for currents in the channels 101, 102, 103...i will have a maximum of 120 channels, ie. 101-140, 201-240, 301-340. The plot has to be current against time. I tried to index the array with a numeric control for the column(to choose the channel). It displays all the plots in one waveform and shows no o/p for the rest. If i probe the chart, it reads perfect values for the channels. The name of the chart is "Waveform Chart".

Kindly ignore the complicated conversions, i will remove them once this waveform is complete.

Thank you,

Message 3 of 11
(2,785 Views)

## Re: Multiple waveforms from a 2-D array

I now have 2 waveform charts that gives me 2 different opuputs,

One allows me to choose which channel waveform to be displayed, its really cool...but it doesnt erase the previous channel's plot...it looks continuous...

The other one also has similar problems...

I was also trying to write the data to a text file, so that i can use the data to make a waveform. Im albe to save the data to a text file, when i try to import the data to a waveform, i dont see anything on the file...

Can someone please tell me what im missing??? I spent quite a lot of time on just the waveforms...

Thank you,

Message 4 of 11
(2,744 Views)

## Re: Multiple waveforms from a 2-D array

Hello Eureka,

This is Andrew Brown, an Applications Engineer from National Instruments. A good method to erase the previous channel's plot is found in an article called How to Clear a Chart Programatically in LabVIEW

In terms of writing the data to a text file, I would recommend setting the "append to file" input to True to ensure you are adding all your data to the same file. Also, I would steer clear of reading from the file at the same time that you are writing to it. More information about inputs to these functions can be found at the LabVIEW help for Write to Spreadsheet File and Read from Spreadsheet File

Please let me know if these resources help.

Regards,

Andrew Brown

Software Engineer
National Instruments
Message 5 of 11
(2,708 Views)

## Re: Multiple waveforms from a 2-D array

Andrew,

Thanks for the tip, i implemented that part.

Im still not getting what i want,

What i want is, i have a waveform chart in my VI. I have a numeric control "Index" with which i can switch outputs between different channel.

Im able to see the different output from different channels in the form of an array, i would like to see that on a waveform chart. So, when i change the "Index", i should see the waveform of the corresponding channel. Also, the waveforms of the previously viewed channels must be stored, but not displayed in the waveform unless chosen from the "Index".

I tried the same thing with waveform graph as well, it shows blank.

Thank you,

Eureka,

Message 6 of 11
(2,695 Views)

## Re: Multiple waveforms from a 2-D array

One solution would be, something like...

If there is a change in the "Index" value, then clear the waveform...

That might work, but im not sure how to implement that condition...

Message 7 of 11
(2,692 Views)

## Re: Multiple waveforms from a 2-D array

I created a condition, where, if there is a difference in the "Index" value, the "clear history" will be executed. I got exactly what i wanted...

Andrew, thanks a lot for the tip...

Message 8 of 11
(2,686 Views)

## Re: Multiple waveforms from a 2-D array

Oops,

I have one final question, Im able to choose between the waveforms for different channels...and it also clears the chart history...

But, if i go to a different channel, it starts over form 0, is there a way to keep the time scale running so that i can see the waveform from the actual 0 and not from that particular instant?

Thank you,

Eureka

Message 9 of 11
(2,678 Views)

## Re: Multiple waveforms from a 2-D array

Hello Eureka,

One method of keeping the time scale (X axis) running would be to store and set the X axis values when you change to a different channel. This feature is demonstrated in the Programmatically Set/Select Range of Waveform Chart's X Axis article.

Please let me know if you have additional questions on this topic.

Regards,

Andrew Brown

Software Engineer
National Instruments
Message 10 of 11
(2,669 Views)