LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

intensity Plot using labview

Solved!
Go to solution

Hello All,

 

I have a question. I am new to labview. I want to get average value of intersity of my scan that I obtained by scaning my sample through AFM. If you looked at my labview program I have four cursers which I can drag around and calculated the average value over the area. But the problem here is If I moved curser X2 the average value doesn't change. But It works fine for other cursers; as I moved other cursers average changes according to graphes average value. Plz help to correct the problem. I have attached the labview program and the file which is to used to get the average intensity. Thanks

Download All
0 Kudos
Message 1 of 3
(2,566 Views)
Solution
Accepted by akc

Greetings, akc;

 

I have opened the VI and would have a few comments.

 

The area of interest is being auto-indexed in a for loop. As such, the mean of a 1D Array is being calculated on every iteration (the mean of every row). That value is indexed and a 1D Array of means is created; in the VI the first value is being taken. 

 

Instead of using the Index Array VI, use another Mean VI and calculate the mean of the 1D array. 

 

Edit: I rewrote a few things in the post to make it easier to understand what I meant.

 

Simon P.

National Instruments
Applications Engineer
Message 2 of 3
(2,538 Views)

Where do I start!

 

First of all, you only have two cursors, not four, so if you try to index out four cursors from the cursor list, you will fail!

 

Here's a very simple rewrite that corrects most mistakes. (I omitted the plot selection, so please add that back)

 

 

(Personally, I would use an event structure, but that would require a bit more code. Keep the original array and the selected plot in shift registers and use a proper state machine to only recalculate whats changed)

 

NOTES:

  • Why are you reading the same file over and over with each iteration as fast as the computer allows? That belongs before the loop.
  • Get the cursor properties directly. Doing the cursor list and unbundling is much more work.
  • use the Max&Min function if you only have two inputs. no need to build arrays.
  • Place a small wait in the loop.
  • You can take the average of a 2D array directly by summing the elements and dividing by the number of elements.
  • For the X values, it would be better to use the cursor index property. Unfortunately, we don't have that for the Y, so vote for this idea!

 

 

Download All
Message 3 of 3
(2,517 Views)