LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Index Array to XY Graph

Hi,

 

I have been working on a project at work where i read the outputted value from one of our boards which comes in string format with "," delimiters.

 

It is the first time i have used labview and i suceeded in obtaining the outputs voltage and current and placing them in to an xy graph. 

 

I believe i went around this a very long and messy way, and not i am trying to work out a cleaner way to do this and also elimintate a bug that i had causing the graph to refresh.

 

I have since taken the string and converted using "Spreadsheet string to array function" followed by the "index array" function which i can select the correct "elements" to recieve the values i am looking for.

 

The problem is now when i input this into an xy graph the x axis "iterations" seems good and flows at the expected rate yet when i input the y data converted to "dynamic data" i see nothing.  As if it is reading the single value each time?

 

Am i missing something, or again barking up the wrong tree?

 

Thanks for your help and patience.

 

Alex

 

0 Kudos
Message 1 of 8
(4,310 Views)

 

The X array and the Y array must be equal size

If you have a 2D array split it up first to have  1X array and one Y array using the index function (array pallete).

 

Bundle the x and y arrays together

 

If you have more than one dataset to look at then use Build array to make an array of clusters of Xarray and Y array. (Build an array of bundles)

 

Finally when displ;aying data you may need to use transpose array (in array pallete) to insure the data is in row major format before you split it into X and Y array for bundling

 

 

 

 

Message 2 of 8
(4,305 Views)

Hi AKA TG,

 

Thanks for you fast response and apologies for my lack of understanding,

 

basically this is my output that i recieve from the board

 

BAT0,-12.21,2.09,BAT1,-12.21,2.13,PWR,12.01,12.00,0.1500,CHRG0,0,0,240,1.866,-10.791,0.00,2,-12,FAN0,1,0,2144, FAN1,1,0,2144, FAN2,1,0,2144, TEMP1:43, TEMP2:255, TEMP3:255,CTEMP,1,1,1,1,50

 

Capture.PNG

Basically, i can extract the values battery 2.09, voltage voltage 12.01 and current 0.1500 after this i take the min max values (which currently dont hold a max value for some reason)

 

I would like to be able to plot voltage on to an xy graph as the y value and also count per sample for the x axis.

 

Even with your comment before I cannot achieve the output on the graph.

 

Each string of data recieved from the board comes at 1 string per second which will need to constantly update in the graph.

 

Any ideas?

 

Thanks again for your help

 

Alex

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

Hi has anyone got a few min to help me out with this one, would really like to crack it before tomorrow!

 

Thanks alot

 

Alex

0 Kudos
Message 4 of 8
(4,258 Views)

You don't show us anything about your arrays and your graphing routine, but it does sound like your string parsing works. In order for anyone to help at all (although AKA_TG actually told you just how to do it), it looks like you're going to have to post your VI containing typical arrays of X and Y that you want to graph.

 

Are you good at working with arrays (particularly how LabVIEW implements them)? Then, have you thoroughly read and understood all of the LabVIEW Help files and examples that they point to concerning XY graphs? This is essential. Then this link shows some applications of XY graphs - I put it here not because you need to understand all of these, but for you to just look at the part about how the graphs are built, for some reinforcement of the examples in the help screens.

 

BTW, one update per second is a glacial pace for LabVIEW, unless you are talking about a ridiculous number of points on your graph (which you wouldn't be able to see them all anyway). Your computer can do it without any problem.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 8
(4,248 Views)

I just saw the VI that you posted earlier this week in another thread. It immediately answers your question here - your X axis has only one point, not an array. But you've got bigger fish to fry. Again, looking at your posted VI, yours is an awfully big project for a beginner to try, especially if you haven't had any LabVIEW training.

 

But, it doesn't have to cost you. To steal a line from RavensFan:

 

"I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours "

 

Please start there, then try some little things before you swim into the Bermuda Triangle.

 

Not criticizing, we were all beginners once, and we all had (at least I did) to learn this same lesson. And then you learn that there's always something to learn.

 

Oh, one small word of advice, in order to learn LabVIEW sufficiently to do big projects, I'd try to stay away from the Express VIs. They make it too easy to cobble something together, then if it doesn't work like you want, (IMHO) it's harder to fix it because you aren't intimately familiar with the details. Plus, they seem to hurt performance because they are doing so much extra behind the scenes. But, YMMV.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 6 of 8
(4,240 Views)

Hey Cameron,

 

Thanks for the advice, to be honest im a hardware test engineer for an RF orientated compant, and this is a small scale project compared to what i have in mind believe me!!

 

The problem i have is that I am trying to persuade the company to switch over to Labview to automate our testing more, so this is a bit of a learning curve project to "influence" them into sending me for LabView core 1 and 2 and the NI Labview RF Measurement fundamentals course.

 

From my previous vi, I actually got it to do what i need except for the bum values i get sometimes from the board i am reading which cause the graphs to reset.

 

I did put a message about this as well and i was informed by a member that it was almost impossible to read as there was too much going on and the labview autotool had played tricks with the wiring. So i decided to try and simplify my drawing. 

 

And so here i am, having fun with arrays! 

 

I think i might just go back to trying to work out how to eliminate the dud reading that i want to viod, this arrays malarky is proving a little intense!!

 

Thanks anyway

 

Your input much appreciated

 

Alex

0 Kudos
Message 7 of 8
(4,233 Views)

@Detox92 wrote:

Hey Cameron,

 

Thanks for the advice, to be honest im a hardware test engineer for an RF orientated compant, and this is a small scale project compared to what i have in mind believe me!!

 

The problem i have is that I am trying to persuade the company to switch over to Labview to automate our testing more, so this is a bit of a learning curve project to "influence" them into sending me for LabView core 1 and 2 and the NI Labview RF Measurement fundamentals course.

 

From my previous vi, I actually got it to do what i need except for the bum values i get sometimes from the board i am reading which cause the graphs to reset.

 

I did put a message about this as well and i was informed by a member that it was almost impossible to read as there was too much going on and the labview autotool had played tricks with the wiring. So i decided to try and simplify my drawing. 

 

And so here i am, having fun with arrays! 

 

I think i might just go back to trying to work out how to eliminate the dud reading that i want to viod, this arrays malarky is proving a little intense!!

 

Thanks anyway

 

Your input much appreciated

 

Alex


I remember that thread.  LOL that block diagram would be enough to convince *me* to send you to formal training.  😉

Please show us your code.  We would love to give you a shove... errr... nudge down the path to LabVIEW nirvana.  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(4,220 Views)