LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to count down from a number

Solved!
Go to solution

Hi

 

I am recieveing a number from a VI, and I want to count from the number recieved down to 1.  The number is subject to change.

0 Kudos
Message 1 of 5
(2,939 Views)

fghfghgfhfhg wrote:

I am recieveing a number from a VI, and I want to count from the number recieved down to 1.  The number is subject to change.


Sounds like a shift register on a While loop and a decrement inside.  What all are you trying to do with this?  That will affect how I would tell you to do this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(2,931 Views)

I am getting a value that returns the last row with data in Excel.  Using that number, I am reading each value from that column, until the last row from Excel and inputing the values into an array.

0 Kudos
Message 3 of 5
(2,927 Views)

No need to count down.  Assuming you are using ActiveX to read an actual xlsx file, you can set a range of cells to read.  You can just use the number of rows value to generate your range.

 

If you are dealing with a text file, then you just use the Read From Spreadsheet File VI and then Index Array to get your desired column.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(2,893 Views)
Solution
Accepted by fghfghgfhfhg

Would this work for you? Wouldn't need a shift register if you're going to go in order.

For each row of data_BD.png

The last iteration should be (123 - 122 = 1). Make sure to take in to account that this would be base 1, so if you're using the Excel VIs you'll probably have to decrement to be base zero index.

 

Edit: Do what crossrulz said if your end goal is the array output, just load it as an array from the start.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 5 of 5
(2,891 Views)