LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build an array continously from measured datas

Solved!
Go to solution

Have a nice day for Everybody,

 

I have a problem regarding building an array continously. I have been trying to find the solution for a long time although it is a really simle task.

I would like to build an array continously, practically:

I am reading datas from a measuring devices and I would like to sotre it one by one, continously. I have done a simple VI to present that where is my problem. The random generator represents the datas given from measuring device.

At presently I am able to store only 1 data. When I want to store the next one it is overwritten.

 

Thanks for anybody who can help me.

0 Kudos
Message 1 of 11
(3,560 Views)

There are many ways obviously.

Here are some:

https://decibel.ni.com/content/docs/DOC-20828

http://www.ni.com/white-paper/4715/en

Search for more if required.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 11
(3,555 Views)

Hi LIG,

 

aCe already gave good pointers for more information.

 

To explain your VI: you take your random number to build an array from it - an array with just one element as your BuildArray node only has that one input. In the next iteration you again build an array, but this time it's a "new" array. As shown in the links you need to store previous values, and that's the point of using shift registers:

check.png

Btw. using BuildArray as shown here in the picture is pretty 'ugly' and not recommended...

Best regards,
GerdW


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

Hi! 

 

Thank you for both of you for the help. 

I tried it and it really works and I feel a bit closer to the solution. I tried to apply it for my problem but I don't know what did I do wrong.

 

So By reading the GPIB I am given that kind of results can be seen on the attached JPG. I would like to convert it to a decimal number without the mark of Voltage, ampere Watt and so on and without the sign. At afterwards store it into an array continously.

 

The important part of the program is in the 2nd case of the case structure.

 

Thank you for your help

0 Kudos
Message 4 of 11
(3,537 Views)

And the attachments 🙂

Download All
0 Kudos
Message 5 of 11
(3,534 Views)
Solution
Accepted by L.I.G

Hi LIG,

 

no need for a case structure when you can use autoindexing:

check.png

The snippet also shows how to convert your read string into a number. You probably prefer floats instead of integers...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(3,529 Views)

Thank you for this... it works really. But there is something other.

You wrote me that I don't need CASE structure for this - As I saw you created an array for the GPIB commands - MEAS?... - I did you structure and it really works except that in the output array I can only see the values of the voltage. Maybe there should be a 4 dimension array to present all the Voltage, Current, Watts, and WHs... but I don't know how to do that or what did I wrong.

 

I would like to say thank you for your help!

0 Kudos
Message 7 of 11
(3,517 Views)

Hi LIG,

 

you did several things different than me:

- you wired a "1" constant for the FOR loop N terminal. Why did you do this? Why should your FOR loop run only once when it should process 4 commands? (Did you try to debug that using highlighting?)

- you created a 2D array in your shift register (instead of mine 1D array). While that isn't bad at all you should also show atleast 4 columns on your front panel too...

 

More hints:

- Please try the cleanup button once in a while. It's really annoying to have to cleanup again and again.

- Do you really need those big symbols for the FP object terminals? You can switch off that in your LabVIEW options...

Best regards,
GerdW


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

Hello GerdW,

 

Thank you for your great help. I works and it makes me very happy.

I would have one more question. Presently I have five column for five kind of measurement results. During a long measurement there are several line. How could I put the time of the actual measurement to the begining of every line as first column. I tried to do an order number for every line as a last column but  I failed. My dream solution would be to put the time of measurement as first column. But I have no idea for this. 

 

Thank you for your help.

0 Kudos
Message 9 of 11
(3,475 Views)

Hi LIG,

 

I really don't know what you tried to achieve with that comparison of "i" with an array with just one element "5". "i" will never be 5, when your FOR loop runs 5 times: it will be 4 in the last iteration...

 

See attachment for hints...

Best regards,
GerdW


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