LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reversing the order of an array

How can I reverse the order of a 1D array without using the "Reverse 1D Array" function?
0 Kudos
Message 1 of 14
(5,201 Views)
What a bizarre question???  This should do it...



May I ask why?


Message Edited by Troy K on 03-14-2008 02:24 PM
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 2 of 14
(5,194 Views)
Here's a way to do it with the LV85 In-Place Element Structure. You could do it without by just indexing and replacing, but this should be more efficient. I tried to optimize it all I could and it's still about half as fast as the built-in Reverse 1D Array function.

But the question still remains, why would you want to do this?




Message Edited by Jarrod S. on 03-13-2008 11:58 PM
Jarrod S.
National Instruments
Message 3 of 14
(5,182 Views)


@jarrod S. wrote:
But the question still remains, why would you want to do this?


Homework?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 14
(5,176 Views)
Touche Smiley Tongue
Jarrod S.
National Instruments
0 Kudos
Message 5 of 14
(5,148 Views)
Thanks
0 Kudos
Message 6 of 14
(5,126 Views)
Hope he gets an "A". Smiley Very Happy
0 Kudos
Message 7 of 14
(5,122 Views)
This is my first post . . . not so fun so far.
0 Kudos
Message 8 of 14
(5,115 Views)
I have attached a vi that will reverse a 1D array.  I have been doing it this way for years and I have found it to be the best way to reverse a 1D array when certain programming guidelines are not important. 

Enjoy!


Message Edited by jmcbee on 03-14-2008 03:45 PM
0 Kudos
Message 9 of 14
(5,112 Views)

@zappper wrote:
This is my first post . . . not so fun so far.

Chill out. Smiley Wink You'd be surprised as to how many homework questions come up on these boards. I'm not accusing you of posting a homework question, though it certainly looks like one. My response was tongue-in-cheek to Ton and Jarrod's response.

Besides, even if it is a homework question you have to admit that with the solutions provided one should definitely deserve an A. Although, jmcbee's Rube Goldberg-kinda solution might set you back to a B+. Smiley Very Happy (Sorry, jmcbee - couldn't resist. It's Friday.)
0 Kudos
Message 10 of 14
(5,092 Views)