LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need guidance in getting data from condition and while loop

Solved!
Go to solution

Ok, thanks.

 

I will share an update.

 

Kind regards

Hasham

0 Kudos
Message 11 of 61
(892 Views)

Hasham622x_0-1719553019420.png

Hasham622x_1-1719553082053.png

 

Hi,

Sorry to bother you again, but thanks to your guidance, the LV code is now saving data. However, it is saving all the data in one long column. I am receiving points from four channels and running 10 iterations, so the data should be organized into 4 columns (one for each input channel) and 10 rows (one for each iteration). Currently, it is saving everything in a single column.


Kind regards

Hasham

 

0 Kudos
Message 12 of 61
(862 Views)

Hi Hasham,

 


@Hasham622x wrote:

However, it is saving all the data in one long column. I am receiving points from four channels and running 10 iterations, so the data should be organized into 4 columns (one for each input channel) and 10 rows (one for each iteration). Currently, it is saving everything in a single column


That's what you programmed to do!

 

You save the data as 1D array and you append to existing data in the CSV file.

When you need a 2D array of data in the end then you should write 2D data to your file!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 61
(848 Views)

Thanks for your reply and if you don't mind, please correct me. To convert data from 1D to 2D, I should connect sub VI "array to dynamic data" and then again dynamic data to a 2D array. 

 

Kind regards

Hasham

0 Kudos
Message 14 of 61
(839 Views)

Hi Hasham,

 


@Hasham622x wrote:

 To convert data from 1D to 2D, I should connect sub VI "array to dynamic data" and then again dynamic data to a 2D array. 


Why do you think you need two ExpressVIs and a DDT wire to build an array?

What about using simple functions like BuildArray???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 61
(834 Views)

Hi,

 

Thanks for your reply and I tried this first convert the 1D array to dynamic and then dynamic to 2D array, and then build the array. This is saving data in array form (.csv file), and I will also share the update that you suggested to me. 

and if I want to save it in binary data format, then which VI I should choose? Could you please guide me.

 

 

Kind regards

Hasham

0 Kudos
Message 16 of 61
(835 Views)

Hi Hasham,

 

you don't need two Express is and that huge IndexArray at all!

All you need is one Build array with just one input to create a 2D array from an 1D array...

 

For binary files you can use the WriteBinaryFile function, but you better clarify the expected file format before going this way!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 17 of 61
(826 Views)

Hi,

 

Thanks for your suggestion, I will share update asap.

 

 

Kind regards

 

Hasham

0 Kudos
Message 18 of 61
(812 Views)

Hi,

 

I am sorry to disturb you as I prepared code in which I got stuck in showing the average values of individual channels on display. Please guide me in this situation.

 

Kind regards

Hasham

Download All
0 Kudos
Message 19 of 61
(845 Views)

Only looking at your image, this needs some work. That constant dance to dynamic data and back is just not right. Your array operations are just silly and make no sense.

First let's get rid of all that extremely convoluted code! 

 

How does the received string look like? Is there a termination character? What kind of "average" do you want? (Average of all points? Average of the last N points? Etc.)

Message 20 of 61
(829 Views)