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: 

Writing array filled with enums to file

Solved!
Go to solution

Hey Guys

I learned alot from the last feedback in this forum, so i call upon you one more time. This is properly yet another trival question, but im also willing to learn.

A bit of recap: Im using a QSM to control a research setup im using. Now i want to put customized sequences in the queue for special experiments. I've made code that does this and it works fine. Basically i make an array filled with enums that describe my state, and queue each enum using a for loop. 

For "hardcoded" sequences the approach above is fine, but if i want to make custom sequences how would one go about doing that. Using what i've learned last time i made the attached code. It can make custom arrays using buttons to imput predetermined sequences. When im done, i want to write the sequnece to a file for documentation but instead of writing what is in my enum it writes the corrosponding number. While this isn't impossible to decode, if feels rather clumsy. Can anybody fix the problem of writing to the file correctly or suggest a different and better approach

kind regards

Atamsih



0 Kudos
Message 1 of 7
(2,554 Views)

Hallo Atamsih,

 

to convert an enum to string you should use FormatIntoString:

check.png

 


but instead of writing what is in my enum it writes the corrosponding number.


Well, what do you expect when you explicitely convert your array of enums to an array of U64?

Best regards,
GerdW


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

Hello GerdW

I tried the FormatIntoString, however, it does not accept an array of enums. Could you modify or suggest how to improve my code that it will?

I must i admit i do not know what to expect. im new to LabVIEW. Could you direct me to a tutorial that explains its?

Kind regards

Atamsih

0 Kudos
Message 3 of 7
(2,548 Views)
Solution
Accepted by topic author Atamsih

Hi Atamsih,

 

yes, FormatIntoString doesn't allow arrays as input. But you could use a FOR loop:

check.png

 

Starter tutorial: http://www.ni.com/gettingstarted/labviewbasics/

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(2,545 Views)

Hi Atamsih

 

You can also refer to an excellent article written about QSM @ http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/

0 Kudos
Message 5 of 7
(2,541 Views)

if you want to save the array of enums to a text file, use one of the steps in the posted code

Regards
Freelance_LV
TestAutomation Consultant
Message 6 of 7
(2,537 Views)

Arhh sigh, should have thought of the for loop. Well thanks for reminding me, i will accept your solution and give kudos.

Thank you, 


Kind regards

Mathias

0 Kudos
Message 7 of 7
(2,534 Views)