11-15-2007 09:12 PM
11-16-2007 12:46 AM
11-16-2007 11:14 AM
11-16-2007 11:28 AM
Look, I am far out on a limb here, because I am not a C programmer. Whatever you're doing would make more sense from a FORTRAN point of view. 🙂
The LabVIEW formula node uses BNF notation (check the help), which is in many ways C like. So the syntax for a FOR loop is:
for ( InitExpression ; CondExpression ; LoopExpression ) Statement
This means the loop iterates until "CondExpression" is true.
Do a google search on "C For loop" and you might find for example pages like:
http://www.hitmill.com/programming/cpp/forLoop.htm
http://www.geocities.com/learnprogramming123/Clesson8Beginner.htm
Your condExpression is "n1-1", which, during the execution of the node is a constant. For example if you array size is 50, n1-1=49, FOREVER! The condition is never true so the loop will never stop.
I hope somebody more knowledgable will chip in at one point. 🙂
11-16-2007 11:29 AM - edited 11-16-2007 11:30 AM
Your condition for stopping is incorrect. You are not comparing it to anything. For example, you should have something like i<n1-1.
You can also quite easily implement this with native LabVIEW functions.
11-16-2007 11:29 AM
11-16-2007 11:45 AM
altenbach and Denis,
Thanks for both of you and you guys are right. My incorrect test condition had something to do with Matlab (not pure though). I thought Labview supports Matlab scripts this way. It should be in the script node that I haven't tried yet. It's working now. I appreciate your time and kindness.
Rut