LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i write this C-Code in G-Code

hallo
 
how can I write this C-Code in LabVIew ,
 
for a=0; a=<10; a++
{
   for b=0; b=5 ; b+2
     {
        X= 3+b;
     }
  Y=1+a;
}
 
please see the attachment and tell me where is the problem
0 Kudos
Message 1 of 8
(2,859 Views)
I can't open 8.5, but I would suggest you use a For Loop
 


Message Edited by JeffOverton on 02-28-2008 11:53 AM
0 Kudos
Message 2 of 8
(2,845 Views)

Well, at least you tried and got some of it right. Smiley Happy

I think this should do what you want, but my C is rusty. Is the increment performed before or after the loop executes? If it's after, then I believe the loop should iterate 11 times, not 10.

In any case, you should note that for a literal translation, you would need to add a sequence structure to guarantee that Y was written to only after the inner loop finished because of the way data-flow works.. Also, note that controls and indicators in LabVIEW are not equivalent to variables. They can be used as such, but they usually should not be.

Another point about this is that you probably want to use the correct data type - the orange terminals are floating point indicators (of double precision, in this case) and you want integers.

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


___________________
Try to take over the world!
0 Kudos
Message 3 of 8
(2,816 Views)
tst, that would give you b=0,2,4
0 Kudos
Message 4 of 8
(2,813 Views)


JeffOverton wrote:
tst, that would give you b=0,2,4

Which I believe is correct, since b is initialized to 0 and the increment is b+2.
 
Isn't C a great language? Smiley Very Happy

___________________
Try to take over the world!
0 Kudos
Message 5 of 8
(2,810 Views)
Oh man, I knew there was a reason I switched out of comp sci after intro C++Smiley Tongue
0 Kudos
Message 6 of 8
(2,808 Views)

Although, then I don't understand how you can get to b=5.

I guess you can consider me confused. Smiley Indifferent


___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(2,807 Views)
Ok, so I wasn't as bad as I thought.
0 Kudos
Message 8 of 8
(2,805 Views)