LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading file and count and decimate array

Hi all
2 little questions:

1)in the count of a read file block how can I insert the EOF(end of file)
condition? instead of use (as now I'm doing) a fixed integer.

2)anyway the array that come up is a 1x480 and i want subdivide it in a
16x30 getting the i-th's 16 elements (the columns) for each of the 30 rows
I've used the decimate array function but unfortunately I have to know
exactly the number of rows that I want, is there a way to set the rows with
a variable number? (getted for example from a digital control)

Thank you very much to any of you that will dedicate me a little bit of his
time.
0 Kudos
Message 1 of 3
(2,758 Views)
I am not sure what you mean in question 1 but I can help with question two. What you will need to do is write an algorithm that will take a 1-d array and make it a 2-d array. Depending on how you want the data split, I supect you will need 2 nested for loops. The great thing about the 2-d array is that you can have n number of rows.
0 Kudos
Message 2 of 3
(2,758 Views)
> 1)in the count of a read file block how can I insert the EOF(end of file)
> condition? instead of use (as now I'm doing) a fixed integer.
>

If you want to read the entire file, use a very large integer and it
will only read what is in the file. Or you can use the more advanced
file I/O functions to seek and tell the file size and read that many bytes.


> 2)anyway the array that come up is a 1x480 and i want subdivide it in a
> 16x30 getting the i-th's 16 elements (the columns) for each of the 30 rows
> I've used the decimate array function but unfortunately I have to know
> exactly the number of rows that I want, is there a way to set the rows with
> a variable number? (getted for example from a digital control)
>

It sounds like you want to use the Re
size Array node. Grow it to have
two inputs and this will allow you to shape your 1D array to a 2D array
of nxm where you can set n and m at runtime. If you don't have enough
data in the 1D, they will be default, and if too much, it will be use
only what it needs.

Greg McKaskle
0 Kudos
Message 3 of 3
(2,758 Views)