LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with arrays

Solved!
Go to solution

Hello everyone!

I was doing a simple practic, it's about a random 3D array and the problem is that I cannot use properly the tool index in realtime with random numbers.

 

Here you have two VI, the first one is simple, it's an 3D array, but if you want you can change de rows, or columns and you will see the element changing for the same 3D array.

 

But in the second one is the problem, here it is another 3D array, but it is filled with random numbers, and when the filling finish it start over again and again instead I can see all the elemnts of the original 3D array.

 

How could I do that the original random array stays until I want to generate the next one, and before I generate the next one I can se all the elemnts by changig the numeric controls (pages, rows and coulmns)??

Download All
0 Kudos
Message 1 of 10
(2,769 Views)

Hello Weegee,

 

Use shift register in your code............

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Message 2 of 10
(2,759 Views)
Solution
Accepted by topic author weegee

Your VI is executing once and then stopping. If you want it to keep updating as you choose different index values then you need to wrap that part in a while loop with a stop condition.

 

EventLoop.png

When you want to generate another set of random numbers hit the stop button, then run the VI again.

 

I suggest you start by reading through some online tutorials about LabVIEW programming. They should teach you the basics.

Start here: http://www.ni.com/gettingstarted/labviewbasics/

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 3 of 10
(2,754 Views)

Hello Troy!!!

 

I'm sorry for the delay but.... I was gettin the labview 2012 in order to analyze your VI, so now...

It works! and it is exactly that I wanted.... but how it works?

Because I already had used a while loop but not that "event structure"

Could you explain me how it works?

0 Kudos
Message 4 of 10
(2,700 Views)

To work the way you want it to, the number generator must execute once and then the while loop must execute every time you change an index value.

The event structure is set to trigger on a change event from any of the index values.

 

Writing to the property node for the "page" index using the Val(sgnl) option triggers an initial change event.

I added it once outside the loop as a simple way to get the change event to fire once at the start.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 10
(2,693 Views)
in a 1-D array of 7 numbers say 1,2,3,4,5,6 and 7... if i want to change the color of one particular element only...say 1 should be in red color and remaining 6 numbers be in green color...how to do that??
0 Kudos
Message 6 of 10
(2,601 Views)

@HussainChachuliya wrote:
in a 1-D array of 7 numbers say 1,2,3,4,5,6 and 7... if i want to change the color of one particular element only...say 1 should be in red color and remaining 6 numbers be in green color...how to do that??

Array elements can only differ in value, not in properties (such as color).

 

You could use an array of clusters, where each cluster contains a numeric with transparent background over a colorbox. Or (if the array is realtively small and of fixed size), you could convert your array to a cluster of numerics for display. You can get an array of references for the cluster elements and then color each as needed using a FOR loop (font color, background color, etc.). Easiest would be to use a table indicator. Here you can color any cell as desired.

Message 7 of 10
(2,584 Views)
thanks for helping...i will try it and will let you know if it worked out for me or not...
0 Kudos
Message 8 of 10
(2,570 Views)

For a simple example of using a table, have a look here. (Resize the table for a single row or column in your case).

 

I think this would be the preferred solution.

0 Kudos
Message 9 of 10
(2,550 Views)
your suggestion for turning array to clusters worked out well...thank you very much sir...!!! 🙂
0 Kudos
Message 10 of 10
(2,540 Views)