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: 

write data into 2D array

Solved!
Go to solution

hello, I'm trying to write my flowing data into 2D array. I have attached a sample vi. What the problem is that:

As can be seen from the block diagram, there is a 2D array whose the first column has constant data. These are 1,0.977,0.955..etc. These are my constant X values. The problem is on writing Y values into the second column.

 

Firstly, I run the program, it executes and I pause it, so it calculates a mean value due to "Amplitude and Level Measurements.vi". So I want to write this mean value to 2.row in 2.column. Then, I push the pause button twice and the program continues again and stops. Then I want the program to write the mean data of this step to 3.row in 2. column and so on. I also want to the value of 1.row in 2. column constant zero. However, after each loop run, the mean value is always overwritten into 1. row of 2. column. The other rows of 2. column are always zero. So I want like this;

 

1             0

0.977      mean value of first execution

0.955      mean value of second execution

0.917      mean value of third execution

0.88       .....and so on .

0.842                          .

0.767                          .

0.692                          .

0.617                          .

0.504                          .

0.391                          .

0.278                          .

0.165                          .

0                                .        

 

after obtaining of this-liked 2D array, I will plot XY graph, and then do curve fitting. My original vi can not be opened fully so I have attached a sample vi. Could you please help me as soon as possible?

0 Kudos
Message 1 of 26
(4,569 Views)

hi ,

 

Not being able to open your VI 😞

 

Regards,

 

Nitz

0 Kudos
Message 2 of 26
(4,564 Views)

Hi mechen,

 

use more shift registers, one for the array and one for the index counter...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 26
(4,563 Views)

Hi GerdW,

Thank you for your reply. I have used shift registers for the array and the index counter. However, it overwrites the previous value into the second column of first row. Could you please try it? thanks ...

0 Kudos
Message 4 of 26
(4,552 Views)

Hi mechen,

 

in your last attached version there is NO shiftregister for the array nor the counter... So please attach the current version! And, please, use only chars from the English alphabet as others might have problems with your (turkish?) filenames ("File not found"...)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 26
(4,544 Views)

Hi GerdW,

I have uploaded the last vi in English name. I have attached the shift register to tha array. However, it does not work. Or I could not understand you. Now, I think you are able to open the file.

 

Best regards 

0 Kudos
Message 6 of 26
(4,529 Views)

Hi mechen,

 

here is a changed version. To call a FOR loop ZERO times is just senseless...

Do you understand the rest of the VI anyway? There are already Shiftregisters, so why didn't you just copy their behaviour? You still have to change this VI for your counter, this one needs a shift register too!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 26
(4,524 Views)

Hi GerdW,

I could not open the vi that you submitted. Could you please save as in 2009 version.

Best regards

0 Kudos
Message 8 of 26
(4,518 Views)

Sorry, now in LV2009.

You should give a note on your LV version, maybe in your signature?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 26
(4,516 Views)

Hi GerdW,

thank you for the last vi. I can open it.However, it still overwrites in the first row of the second column. I couldn't understnad where I put in the shift register.

0 Kudos
Message 10 of 26
(4,508 Views)