From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmably delete empty column in 2d array


@Hooovahh wrote:

I wonder if this is an example of Cunningham's Law.

 

"The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer."


It might be, but regardless it is heck of a lot better then asking a question and showing no answer.

 

Also, Jimmy I am just using this code in a larger program, that I do not think I post, where there is some user input.

 

And thanks Raven for the snippet. Also, in that snippet what is defined as empty? Is it defined as any string or character that has a value that is greater then zero?

0 Kudos
Message 11 of 17
(1,599 Views)

Any string that has a length greater than 0 is NOT EMPTY and gets included in the output array.

 

I used a special feature of the concatenate function that converts an array of strings into a single string.  If the length of the that is greater than 0, then 1 or more of the original array elements must have had some characters in it, and that row will be used in the new array.

Message 12 of 17
(1,574 Views)

I'd go with this.

remove empty cols.png

0 Kudos
Message 13 of 17
(1,559 Views)

Hi,

Thanks for the code, Can you pls attach the same code for reference.

0 Kudos
Message 14 of 17
(883 Views)

@vamshikrishna wrote:

Hi,

Thanks for the code, Can you pls attach the same code for reference.


This is quite an old thread and it is not clear which code you want. In any case, most of the images above are "LabVIEW snippets", so you can drag them into the diagram and they will turn into functional LabVIEW code.

Message 15 of 17
(881 Views)

I tried the same but only image is coming into the block diagram. i was looking for attached image LabVIEW code.

0 Kudos
Message 16 of 17
(871 Views)

It would be faster to just recreate it from scratch. It is also a good exercise.

 

  1. transpose array (array palette)
  2. FOR loop (structures palette)
  3. concatenate strings (strings palette)
  4. String length (strings palette)
  5. >0 (comparison palette
  6. conditional output tunnel (regular auto-indexing tunnel, right-click...tunnel mode... conditional)
  7. transpose array (array palette)

(several things could be done differently, but this is sufficient)

0 Kudos
Message 17 of 17
(864 Views)