ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extracting data from a for loop

Solved!
Go to solution

Hi,

I have written a program which commands a current supplier to raise the current from 0 to 50 A, during 1000 iteration. This current goes through a coil and forms a variable magnetic field. A gaussmeter is provided to measure the field. My aim is to record the field for each iteration. I have added the gaussmeter program in initial for loop so that I can read field corresponding to each momentary current. My problem is how to extract an array containing 1000 recorded fields from the loop and save it. I really appreciate it if you guide me.
Many thanks,
Hadi

0 Kudos
Message 1 of 8
(6,720 Views)

share the code which you tried.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 8
(6,718 Views)

Hi Hadi,

 

use autoindexing tunnels to get your array with 1000 measurement values!

 

It's a very basic LabVIEW feature so I want to recommend you to go through the free online resources provided by NI.com to learn LabVIEW! 😉

Best regards,
GerdW


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

Hello!

 

I'm not pretty sure I have understood you correctly but I have prepared some 'overview' piece of code. Maybe you can extract something from it 🙂

 

If you still have problems, please share the code.

 

Marcin

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 4 of 8
(6,701 Views)

Dear Marcin I'm really grateful for your valuable response. I attached my code. It is a flat sequence structure includin 5 frames. In frames 1, 3, and 5 I've added a programe to read the field. I need a file containing 1000 values of recorded fields.

Bests,

0 Kudos
Message 5 of 8
(6,685 Views)
Solution
Accepted by hadi1989

Hello!

 

As I understand from your code you get the values as a strings? (substring, substring 2 and substring 3)

 

In my opinion the best way to do it without refactoring the code is to create a queue with string as datatype. See the attachements (VI Snippet and VI contains exactly the same code but I have saved VI for the LabVIEW 8.6 version).

 

For the future projects, consider using State Machine https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentat... Stacked (or flat) Sequence Structures are really diffucult to understand for other people than developer.

 

It is also always easier to share the code using VI Snippets https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US

 

Please, let me know whether it has helped you 🙂

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 6 of 8
(6,676 Views)

many many thanks. your tips are quite helpfule and precious. 

0 Kudos
Message 7 of 8
(6,651 Views)
Solution
Accepted by hadi1989

Hi hadi,

 

I need a file containing 1000 values of recorded fields.

Then why don't you save the string(s) one after the other into a file? No need to build arrays first…

Atleast it would have been the first and simplest method to store your data!

 

Beside this:

Learn LabVIEW. THINK DATAFLOW!

Reduce the usage of sequences…

 

Best regards,
GerdW


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