From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

text file issue

Hi,
I can read numbers from text file and input them into an array, BUT how do i read one number and put that in a element of the array .Then read another number and put it in the next column of the 2D array.
eg 50, 41
The array will have 50 in the first element and the second element in the array will be 41 etc
thank you
mik reid
0 Kudos
Message 1 of 2
(2,147 Views)

I'm not sure what you mean because in your first sentence you say you do know how to read a file into an array and in the second sentence you ask how to read a file and put it into an array. If you file is of the format:

50,41
52,42

Then Read From Spreadsheet will create a 2D array with 50 in row 0, column 0, 41 in row 0, column 1, 52 in row 1, column 0, 42 in row 1, column 1.

If your data is of the format:

50,41,52,42

Then you can use Read From Spreadsheet, take the 1D array output and use Reshape Array to create a 2D array like in the attachment.

0 Kudos
Message 2 of 2
(2,136 Views)