LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop not Executing

Solved!
Go to solution

Dear all,

I am new in LabVIEW and I would like your help if that is possible. As part of my master thesis, I have to use a program written by a PhD student several years ago. I am using LabVIEW 18 in windows 10.

At a point I have to read some values from a bunch of text files and convert them into a table that will be read from my main.vi.  

This procedure is done using READFILEVI.vi (picture, txt file and vi are attached)

Using the probes I observe that that the txt file is properly read by the program (after probe 24). Then a combination of functions are used to get the size of the array and feed this value on the for loop count terminal. However, even though everything looks fine until this point the for loop is not executed and when I observe probe 30 there is an array with all the elements being 0 instead of the actual values of the txt file. Do you know why this might be happening, since I do not get any errors or warnings during execution that can lead me­? 

As a side note to clarify, you can observe the case structure that includes the for loop is inside a larger while loop which basically runs until the condition on the bottom right is met. This is there basically because this program is designed to convert a bunch of txt files with names 40, 41…149, 150. In the picture attached I have set this value to 150 because I wanted to investigate one file at a time.

Thanks a lot in advance,

George

 

 

Download All
0 Kudos
Message 1 of 4
(1,055 Views)
Solution
Accepted by topic author amfetam1n

kosist90_0-1609330925012.png

 

For Loop executes the least number of iterations given either by N input, or by auto-indexing. Now there are connected both: but input array is empty, thus For Loop is not executed.

Message 2 of 4
(1,031 Views)

Besides the explanation given by kosist90, I may add that almost the whole read code can be replaced by a single vi: Read Delimited Spreadsheet. Just give the correct format as input and extract the first (and only) column from the 2D array output.

The current code is unnecessarily complicated. Moreover, it seems a little odd to have floating point values stored into a file and read only their integer part. But this may be legitimate, of course.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 4
(1,009 Views)

Thanks a lot for the insight. its executing now.

Cheers,

George

0 Kudos
Message 4 of 4
(1,001 Views)