LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Array

Hi,
 
I am saving data from a matrix of one column in a text file, as shown in Figure1.
 
Then I want to be able to load the text file in the matrix. I am doing that with local variables. For now I do this like in Figure2 but it doesn't work well.
 
If I enter and save what's in Figure3(A), when I load back, I obtain Figure3(B).
 
How could I separate the data to get back the initial data? I searched a lot of functions but I didn't found...
 
Thank you very much,
 
Jack
Download All
0 Kudos
Message 1 of 10
(3,002 Views)
Hello Jack,

That's a simple thing to do. But it's better if you post the vi and say what's your labview version. Because in my version (8.5) I've some vi's that could make your life easier.
Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 2 of 10
(2,976 Views)

Hi,

Here is the VI.

I think the problem is coming from when I save but i'm note sure because the save file seems correct...

I am using Labview 8.0.

Thank you,

Jack

Download All
0 Kudos
Message 3 of 10
(2,967 Views)
Is there a reason you are using a matrix instead of a 1D array for your 1D data? When you use built array, you are actually generating a 3D array that you then write to the file.
0 Kudos
Message 4 of 10
(2,965 Views)
The reason I am using a matrix is that I was unable to enter data on the front panel in an array as I can do with a Matrix...
 
And I don't know what to do else than build array to transfer my data to have it together in two columns.....
 
Thank you very much,
 
Jack
0 Kudos
Message 5 of 10
(2,963 Views)


Jack42 wrote:
The reason I am using a matrix is that I was unable to enter data on the front panel in an array as I can do with a Matrix...
 
And I don't know what to do else than build array to transfer my data to have it together in two columns.....
 
Thank you very much,
 
Jack



You can enter data into an array just as easily as you can a matrix. That fact that you changed the display of the matrixes to hide the index display or other columns does not change them from a 2D data type. Change all of the matrix's to 1D arrays.
0 Kudos
Message 6 of 10
(2,955 Views)
Hi,
 
Ok, thank you very much, I changed to the array!
 
I will try to go further with that tomorrow.
 
If I make two 1D array, is there a way to save the data so I can have them in a two column table??
If I make a 2D array, is there a way to take apart to my subVI block only the X or Y data??
 
Thank you very much again !!!
 
Jack
0 Kudos
Message 7 of 10
(2,951 Views)
The answer to both of your questions is yes. If you use the Build Array on 2 1D arrays and pass that to to Write to Spreadsheet, then you will have a file with 2 columns of data. Without looking at your VI again, you may or may not have to transpose the 2D array when you write it. You use the Index Array function to get a specific row or column from a 2D array.
0 Kudos
Message 8 of 10
(2,934 Views)

OK, I cleaned up your VI slightly. Especially the subVI was a mess (many multiplications by 1, taking the inverse tangent twice from the same inputs, many other duplicate operations, etc.).

I would keep it simple and use 2D arrays directly. One for the input and one for the output. Also use a shift register instead of all these local variables in the main VI.

See if it makes more sense. (Please verify correct operations. It's not fully debugged). I am sure improvements are possible. 😄

0 Kudos
Message 9 of 10
(2,926 Views)

Hi!

Thank you very very much !!

It's working very well !

Thank you again!

Jack

0 Kudos
Message 10 of 10
(2,899 Views)