LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build 2D String array from only one case condition

Solved!
Go to solution

Hello,

 

I'm having a problem when I'm trying to build a 2D array of string elements. Here's basically what I'm trying to do:

 

I start off loading arrays from various text files (Session_001.txt, Session_002.txt, etc) and concatenating them into 1 big array. 

On every line of the Session text files, there is the session number, various caracteristics of hockey sticks, and then a couple results.

I want to be able to select different caracteristic and then display the corresponding results. Right now, I`m working on selecting the Session, and when I get that working, the rest would be similar (I suppose).

 

The problem I`m having is that when I'm selecting  the Sessions I want, the resulting Array3 (with all the data) is filled with empty lines (1D array of empty elements). I had the same problem when outputing a 1D array (Array 2) which just showed what Sessions had been selected, but I managed to fix that by searching and removing the empty elements.

 

The problem resides withing the case structure I have. I am comparing every element of the first column of my huge 2D array with every number of the Session selected, and when it's "true", I keep the current line to go to Array 3. If it is "false", nothing should happen (I have a shift register passing through my "false" case, but a row of empty strings is added the the array.

 

What am I missing?

 

I know this probably sounds very confusing, so I'm attaching the VI alone and a zip containing the VI and my text files. 

 

Thanks!

 

 

Off subject (well, still on the subject of my VI), will it be possible to assign a different color to every stick type (MX3, APX3) or different marker type for different type of shots (WS, SS), etc when I want to display the results on the same graph? If not, stop me now and i'll move on to Matlab.

 

Download All
0 Kudos
Message 1 of 4
(3,130 Views)

Hi bob,

 

when it's "true", I keep the current line to go to Array 3. If it is "false", nothing should happen … What am I missing?

Well you miss to keep previously stored lines as you replace them by the current line.

You miss to use autoindexing and conditional output tunnels, too.

And you haven't read the RubeGoldberg thread in the forum as you use the classic Rube "equal to TRUE" in your code…

 

when I'm selecting  the Sessions I want, the resulting Array3 (with all the data) is filled with empty lines

It's because you explicitely add those empty strings to your array when checking your "Cluster" input! Don't add them and you will not have to delete them later on…

 

will it be possible to assign a different color to every stick type (MX3, APX3) or different marker type for different type of shots (WS, SS), etc when I want to display the results on the same graph?

Yes, graphs can show more than one plot and each plot has it's own set of properties!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,113 Views)
Solution
Accepted by topic author bobzwik

Oh my.... Equal to true.... I feel so ashamed.

 

I just started Labview on my internship 2 weeks ago. There's probably many simplifications I can do to my VIs, but as long as they work and don't burn up my laptop, I'm okay.

 

As for the conditional tunnel, I don,t really know how to use that yet, but I figured out the problem with my Shift register. I created a 2D empty array outside of both loops, and added a shift register. I then build I was trying to base myself off another thread

 

Solved VI is attached to anyone who cares 🙂

 

Download All
Message 3 of 4
(3,100 Views)

@bobzwik wrote:

Oh my.... Equal to true.... I feel so ashamed.

 Solved VI is attached to anyone who cares 🙂

 



We learn by making mistakes. The Rube Goldberg thread is a fun and good read. Since most Rubes also include a much optimized solution to the same problem i've learned a lot from it, i also found quite a few rubes i've done in the past, often due to not knowing some function (as enum to string through Format into string).

You can mark the solution so it's visible to others checking the thread.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(3,071 Views)