LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Array Elements

Hello,

 

I would like to graph a row of pixels.

 

The code below can load an image and convert it into a 3D plot based on the X, Y and pixel value.

 

I want to look at all the pixels in a row along the x axis and graph them on a xy graph.

 

Can someone help.

 

Cheers

 

Download All
0 Kudos
Message 1 of 7
(3,357 Views)

OK, So I figure it out.

 

Here is the code.

 

I had to first select the row/col that want to see. Then convert that into a 1D array. From there, plot the data I want.

 

 

If anyone can point out how to optimize the code, it would be great. 

 

 

Cheers

 

 

0 Kudos
Message 2 of 7
(3,343 Views)
0 Kudos
Message 3 of 7
(3,342 Views)

Why do you have a while loop in your program?

 

Once the image is loaded, the while loop starts.  Nothing ever changes from inside the while loop.  And the while loop is running at full speed since you have no wait function in there.  So you are pegging your processor doing things over and over and over with the only possibility that you hit the stop button to end the program.

 

When I ran your program, I saw graphic anomalies because the CPU didn't have enough time to redraw the screen properly when I moved the scroll bar.  And when I hit the stop button, LabVIEW completely crashed without warning back to the desktop.

 

(Actually, LabVIEW crashed even after I removed the while loop.)

Message Edited by Ravens Fan on 03-10-2010 10:17 PM
 On later review, I do see a control inside your loop.  It was difficult to find because you hid the labels on your controls.  Always show labels on the terminals for controls and indicators in your block diagram!
So with a control, you should use an event structure so it only does the calculations when the control changes.  And there is no need to have the picture graph inside the loop because it never changes.
 I still don't know why your VI crashes my LabVIEW.  I suspect you've got a problem inside that picture control.
Message Edited by Ravens Fan on 03-10-2010 10:20 PM
0 Kudos
Message 4 of 7
(3,331 Views)
As was mentioned, you need at least a wait inside of your while loop.  I also noticed that there is a lot of your code that doesn't need to be in a while loop at all.  All you need in your while loop is data that is going to be chaged by the control.  I put in an event structure that includes only the code that needs to be inside of the while loop.  Play with it a little and post if if have any other questions.
National Instruments
Applications Engineer
0 Kudos
Message 5 of 7
(3,312 Views)

Hello Scott,

 

I'm running 8.2. Could you please repost.

 

Thank you

 

0 Kudos
Message 6 of 7
(3,306 Views)
My apologies, here it is in 8.2.
National Instruments
Applications Engineer
0 Kudos
Message 7 of 7
(3,288 Views)