cancel
Showing results for 
Search instead for 
Did you mean: 

Create array with for loop

Egorkkk
Member

Create array with for loop

Hello.

 

Stupid question, but i can't do it myself.

 

I receive scalar byte data from com port in main while loop and want to make 1D array with adjustable size for further filtering and so on. Simple "for loop" with indexed output makes me array with all the same elements.

 

Can anyone tells me how can i make this?

 

Thank you.

33 REPLIES 33
Dennis_Knutson
Knight of NI

Re: Create array with for loop

Build array with a shift register. This would be in your main acquisition loop. It does sound like you could make use of the pt-by-pt functions, though.

Egorkkk
Member

Re: Create array with for loop

Can i tell more about you solution? Shift registers in main loop or in for loop? Or can you show me example, please

Dennis_Knutson
Knight of NI

Re: Create array with for loop

Message contains an image Message contains an attachment

In the main loop where you are doing the scalar acquisition. You need to post your VI if you need help.

 

Egorkkk
Member

Re: Create array with for loop

Ok, thank you very much. I'll try this and post if there will be questions. Thank you.

Ranjeet_Singh
Active Participant

Re: Create array with for loop

Why can't you use string to byte array function.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Egorkkk
Member

Re: Create array with for loop

First, sorry for my english.

 

I receive bytes every 10ms and want to use filters and other processing. So, thats why i want to create 1D array with adjustable size. In other words, "stacking" 8 (or 4 or 100) bytes to 1D array. I know, that this is simple, but have a "wall" in my head )

Highlighted
Ranjeet_Singh
Active Participant

Re: Create array with for loop

Message contains an attachment

Try this & let me know.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Egorkkk
Member

Re: Create array with for loop

Message contains an attachment

Ok, i was try your example. I'm replace random generatro with input from visa and see that all elements of array are identical...

Here is my VI. First part of it is simply for formatt input from COM port - take two bytes from array and make word.

Ranjeet_Singh
Active Participant

Re: Create array with for loop

2011 compatible VI please

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet