LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help defining and putting information into an array in a formula node.

I want to make an array of size x.
I then want to put it inside a loop (for, while)
and put information into the array from 0..to..x.
 
I am getting a lot of errors and the help pages aren't helping me.
 
 
0 Kudos
Message 1 of 4
(2,785 Views)
What values are you trying to insert into the array? If you just wish to create an array of size x and all are the same values, then Initialize Array will work. You can also use a for loop and autoindex an output to automatically create an array. The attachment shows a for loop creating an array with the values 0 to x-1 and the Initialize Array function. If you are getting errors, it would help if you would say what the errors actually are or attach your code so someone could look at what you've attempted.

Message Edited by Dennis Knutson on 12-13-2005 11:39 AM

0 Kudos
Message 2 of 4
(2,784 Views)
I wanted to do it in a formula node like for example.
 
 
int a = 10;
int x = 1;
int inc = 1;
 
int arraytemp[samples];
 
while(a < inc*x)
arraytemp[samples] = inc*x;
x = x + 1;
end
 
This is how my code looks as far as setting up the array and putting information into it.
Why I am getting syntax errors all over the place.  I know am not sure the 'end' is correct
but I had errors before that was in place.
0 Kudos
Message 3 of 4
(2,776 Views)
Sorry, I missed the formula node reference in the subject. I don't use formula nodes that much. I find it easier to use pure G instead. I don't believe that you can dynamically define the size of an array in a formula node and I think you've got some logic problems in your while loop. I've attached a formula node that works and uses a for loop instead but I'm not sure what the final data is supposed to be.
0 Kudos
Message 4 of 4
(2,761 Views)