LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making dynamic Variables in LabVIEW

Hello, 

 

I have the following code, which I am trying to implement in LABVIEW. The problem what I am facing is while setting up the IF case structures (Specifically how to make the case selectors).

Here 'detsq' is a threshold value. In the below program, I have figured out how to make the case selector for the first IF loop. I will compare the detsq simply with 0.1. 

 

But for the second if loop, how to set up the flag variable.In this case I have to test flag variables value for entering the loop and at the end also set it to certain value.

 

Can someone give me hint on how to make such a program/deal with such loops.(Just Idea).

 

for i = 1:length(detsq)
if (detsq(i) > 0.1)
if (upflag == 0)
if (last > 0)
t = i - last;
p = 1000/t*60;
end
last = i;
end
upflag = 100;
else
if (upflag>0)
upflag = upflag - 1;
end
end
pulse(i)=p;
end

0 Kudos
Message 1 of 3
(2,631 Views)

First, I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

The key things you'll be using in LabVIEW besides the comparisons and case structures you have are "For Loop".  Auto-indexing tunnels  (does a "for each" element of the incoming array).  And shift registers which return a value assigned in one iteration of the loop back to the beginning of the loop to be used in the next iteration.

0 Kudos
Message 2 of 3
(2,611 Views)

If you want to study LabVIEW, then invest some time into tutorials. You will need to change thinking from variables to dataflow. Term "Variable" in LabVIEW serves very different purpose and can be easily misused. If you use them for this task, you are misusing them.

If you need just to solve this only task and forget about LabVIEW, simple formula node is enough - paste your code there, add inputs-outputs, define dynamic variables.

0 Kudos
Message 3 of 3
(2,585 Views)