LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing 3d Array

I have all the ASCII characters read from a binary file I already populated. My next step is a user being able to type out a string and each letter (a page in the 3d array) showing up in order that it was typed in and than can be cycled through. An example is a user types out BEN this will produce 3 pages from the 3d 5x7 matrix that are in order of the capital ascii characters.

0 Kudos
Message 1 of 10
(758 Views)

I would start with a few basic tutorials to eliminate all the race conditions and greedy loops.

0 Kudos
Message 2 of 10
(750 Views)

Where would I find these tutorials and do they cost money?

0 Kudos
Message 3 of 10
(747 Views)

Check the learning resources at the top of the forum.

 

(I am currently at a conference and will look at your code later.)

0 Kudos
Message 4 of 10
(730 Views)

For a tutorial on race conditions I would recommend this short 12 minute video:

https://www.youtube.com/watch?v=9T1pqnGt9kU

 

The solution they show, using a FGV, is one of the (but not the only!) solutions to fix race conditions.

 

The whole channel is basically abandoned (last video made 8 years ago) but they did a pretty good job explaining things well in short videos and the content still holds up.

Message 5 of 10
(684 Views)

Instead of a 3D array, create a 1D array of clusters, each containing a 2D array of booleans. Much easier to manage.

 

0 Kudos
Message 6 of 10
(678 Views)

Here's one possibility. You can easily change the LEDs in each cluster to an 2D array of 24 booleans (e.g. 5x8)

 

 

10digit7Segment.png

Message 7 of 10
(660 Views)

You failed to attach your display-copy.txt (or similar) file. Once you have th2 3D array, you can just index into it.

 

Here's a highly simplified version that has a 3D array with just numbers corresponding to the plane index.

 

altenbach_0-1718333859952.png

 

Message 8 of 10
(653 Views)

Thank you altenbach and Kyle97330 for your advice and help. I finally figured it out by using a for loop inside a for loop (definitely not the most efficient way but the string will not go past 8 characters leading to no worry with efficiency). If I were redoing this vi I would most likely use the 1d array of clusters containing the 2d arrays as recommended by altenbach. Also, the Display - Copy.txt file is just a binary file containing the cluster of the matrix and the character array connected to the individual 2d matrix that I wrote to a binary file in the original vi. I will attach here incase anyone stumbles upon this discussion. The point of the attached vi is you write any string and it populates the matrix with the pages of the characters that were inputted that you can then tab through.

 

I also add a blank character at the last index for the character matrix as I forgot to add when inputting them in the original vi I attached.

 

If you have a more efficient way I would love to see as I am interested in what I could do better.

Download All
0 Kudos
Message 9 of 10
(619 Views)

@Harthion wrote:

Thank you altenbach and Kyle97330 for your advice and help. I finally figured it out by using a for loop inside a for loop (definitely not the most efficient way but the string will not go past 8 characters leading to no worry with efficiency). r.


I don't even try to understand what you are saying. A FOR loop is one of the most efficient structures (However, your outer FOR loop does nothing useful and just repeats the same operation N times.)

 

If you want us to play with your VI, you need to also attach the "text" file. And yes, it can be dramatically simplified.

 

Of course it is a really bad idea to have a binary file with a *.txt extension. Bad form! (Also give it a better name than "Display - Copy.txt")

0 Kudos
Message 10 of 10
(602 Views)