LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading and writing to array

Hi,

 

I was really hoping to get some advise on making my application more robust and doing things the 'right' way.

I have develpoed an application and it works but not in the best way. I have a VI stretchign about 5 laptop screens (no SUB VI's) and lots of array reads and writes. I was hoping to get some help on the best way of reading and writing from arrays.

 

My application reads the DAQ every half a second and acquires data which is processed real time. Currently my structure is briefly explained in the .jpg.

TO begin with I used a simple flat sequence structure but I now understand that I need to change the structure.

Can somebody point me to a way of reading adn writing to arrays in the different stages. I would really appreciate some simple example to go with the explanation.

Thanks for the time and effort.

0 Kudos
Message 1 of 7
(3,854 Views)

First and foremost, you need to understand the differenced between LabVIEw as a graphical language versus text-based languages.

You do not need to declare variables as the wire is the variable.  Also get rid of ALL Local Variables.

 

I'll mention it again.  First start by cleaning up the code by removing ALL Local Variables.  Also, although they look nice, Flat Sequence Structures are not necessary.

 

I'm not sure what you want to accomplish with the two While Loops, but you may be able to implement the dolution with a single loop, unless you are planning on having a Producer-Consumer arrangement.

 

Your solution might be well suited for a State Machine, which uses a single While Loop.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

 

Your code is not all bad.. 😉  I like the clean look and the documentation.  You obviously have written good software before, probably in a text-based language.  That experience will help you quite a bit.  However, you may have to adjust your thinking from a sequential view to a data-flow view.

 

LabVIEW uses data flow to execute the code.  That means that any portion of code and and will execute as soon as it has data.  That's the trouble with Local Variables, as they will ALL have data at the same time, thus breaking the data flow that LabVIEW relies upon for establishing order (like a sequencial flow).

 

Hope the above helps.  Also remember to try to keep your code to a single screen.   A State Machine (While Loop with a Case Structure indexed by a TypeDef) will be useful to keep your code within a single screen.

 

RayR

Message 2 of 7
(3,845 Views)

Definitely its a wonderful post Ray. Clear cut message within 10 minutes of the original post. Worth a 1000 kudos. Nice to see your active participation after a long time.

 

Mathan

Message Edited by Madboy(Mathan) on 09-29-2009 07:22 AM
0 Kudos
Message 3 of 7
(3,836 Views)
Is this a similar discussion to this one?
0 Kudos
Message 4 of 7
(3,833 Views)

Thanks Madboy Mathan.

 

It's good to be back.  Still trying to keep sane with the vision problem.  But heck..  I've learned to manage with the keyboard.  I've somewhat become dyslexic, so I understand Ben...  Maybe I should have said that in his thread..  😄

Message 5 of 7
(3,830 Views)

Hi Ray,

 

Defiintely makes sense!! Thanks for that!

Yes, the two posts are related. As posting the code didn't raise much interest, I thought just explaining the strucutre may help. If you have looked at the code in the other post you propbly got an idea of my confusion.

 

I think a producer consumer loop with state machines in the producer loop will do the job.

I am basically trying to develop a real time biofeedback algorithm that acquires human pulse and processes it and guides user (front panel graphics) to modify their physical activity to them monitor its affects on pulse and so on.

0 Kudos
Message 6 of 7
(3,818 Views)

Hi Jaspal,

 

Glad to help.

 

I can't look at your code until tonight (No LV installed here).

 

Your project does seem quite interesting.   And from personal experience, yes, you can learn to monitor and to a degree (or maybe better with practice) control pulse and blood pressure. Biofeedback would make things much easier.

 

R

0 Kudos
Message 7 of 7
(3,812 Views)