LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

formula node

Dear friends

I have two input arrays; say sq and pd .each of which is 1000 points in length
sq is a square wave pulse and it was fed into a system and the output was recorded in  the pd one. I would like to read the results from the pd arrays  when  the sq value become between 3.5 and 5 so I have written this math script codes:

             uInt32 i;              
             uInt32 pos_1;
             uInt32 pos_2;
       
            for (i=0;i=1000;i++)
           {
            if ( (sq[i]>=3.5) && (sq[i]<=5))
            pos_1[i] = pd[i];
           
             else
              pos_2 = pd[i];

when I run I received the following error:
array type required
pos_1[#i] which means it does not recognized pos_1[i]

any ideas please

0 Kudos
Message 1 of 4
(2,961 Views)
There are actually a couple of mistakes in your formula.  Your declared variables are scalars and yet you are treating them as arrays in the assignments.  You also forgot your closing brace.  This one does not have a broken arrow, but I don't know if it works as I am unsure of your intended results.

             uInt32 i;              
             uInt32 pos_1[1000];
             uInt32 pos_2[1000];
       
            for (i=0;i=1000;i++)
           {
               if ( (sq[i]>=3.5) && (sq[i]<=5))
                  pos_1[i] = pd[i];
              else
                  pos_2[i] = pd[i];
            }

I hope that this helps,
Bob Young

Message 2 of 4
(2,949 Views)


@rumayan wrote:
any ideas please


Well, I would strongly suggest to abandon the formula node, LabVIEW can do these things much better using wires (seriously!) 😄

Attached is a quick attempt, modify as needed. (It would also be easy to modify such that the output arrays don't contain zeroes if the other output array receives data).

Message Edited by altenbach on 07-25-2006 09:56 AM

Download All
Message 3 of 4
(2,932 Views)
thanks to all of you
I think this code is the right one(thanks to Bob Young)
              uInt32 i;
             uInt32 k;           
             float pos_1[1000];
             float pos_2[1000];
       
            for (i=0;i<=1000;i++)
           {
            if ( (sq[i]>=3.5) && (sq[i]=5))
            pos_1[i] = pd[i];
           
                       }
which exactly will read the data on Pd array when the sq pass between 3.5 and 5
thanks
altenbach I learnt something new from you as well.
0 Kudos
Message 4 of 4
(2,898 Views)