LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting Array to String challenge

I have a 1D array of integers.  For example: 

paul_a_cardinale_0-1736359565783.png

I can easily use this:

paul_a_cardinale_1-1736359683170.png  to yield this: paul_a_cardinale_2-1736359716205.png

But what I really want is for every other separator to be a slash, like this:

paul_a_cardinale_4-1736359885507.png

 

Who can come up with the simplest code to do that?

0 Kudos
Message 1 of 21
(273 Views)

I'd actually rather see how Rube-ish we can get it.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 21
(270 Views)

If using subVIs from vi.lib is allowed:

raphschru_0-1736361076979.png

 

0 Kudos
Message 3 of 21
(258 Views)

@raphschru wrote:

If using subVIs from vi.lib is allowed:


And if not (or even in general!), we would probably do this.

 

altenbach_0-1736366852785.png

 

 

(Of course we must be assume that there is an even number of elements)

0 Kudos
Message 4 of 21
(215 Views)

Yeah but "Array To Spreadsheet String" annoyingly adds an End of Line at the end, so you would have to trim that.

0 Kudos
Message 5 of 21
(199 Views)

@billko wrote:

I'd actually rather see how Rube-ish we can get it.  😉


For a start...

 

Example_VI.png

Message 6 of 21
(196 Views)

@raphschru wrote:

Yeah but "Array To Spreadsheet String" annoyingly adds an End of Line at the end, so you would have to trim that.


Yes, a simple trim whitespace (as in the original code) will do that...

(Still faster than digging through vi.lib unless you know exactly where things are ...) 😄

0 Kudos
Message 7 of 21
(191 Views)

@altenbach wrote:

@raphschru wrote:

Yeah but "Array To Spreadsheet String" annoyingly adds an End of Line at the end, so you would have to trim that.


Yes, a simple trim whitespace (as in the original code) will do that...

(Still faster than digging through vi.lib unless you know exactly where things are ...) 😄


Toolkit "Hidden Gems in vi.lib" adds a palette to expose some functions like this one.

I am sure Paul has it, since it adds some hidden scripting functions as well 🙂.

0 Kudos
Message 8 of 21
(182 Views)

@billko wrote:

I'd actually rather see how Rube-ish we can get it.  😉


challenge accepted....

 

Rubeformatting.png

Message 9 of 21
(178 Views)

@billko wrote:

I'd actually rather see how Rube-ish we can get it.  😉



Another try:

 

BertMcMahan_0-1736376330417.png

 

Message 10 of 21
(160 Views)