Jump to content

Can't Add Elements To Array


fillalph

Recommended Posts

Hello Everyone,

I have uploaded my VI along with a picture of what the output is at the end.

I am able to acquire data correctly, no problem with that. The problem I am having is that "Array_Editted" is empty (the 2nd sequence in my code isn't working properly). I tried to step through the code to see where the problem was, but that didn't help. When looking at the probe of array_editted, the values are greyed out.

Any suggestions would be greatly appreciated. I have a feeling I am going to feel like an idiot when I figure it out :S

Thanks :)

fillalph

Link to comment

Hello Everyone,

I have uploaded my VI along with a picture of what the output is at the end.

I am able to acquire data correctly, no problem with that. The problem I am having is that "Array_Editted" is empty (the 2nd sequence in my code isn't working properly). I tried to step through the code to see where the problem was, but that didn't help. When looking at the probe of array_editted, the values are greyed out.

Any suggestions would be greatly appreciated. I have a feeling I am going to feel like an idiot when I figure it out :S

Thanks :)

fillalph

Link to comment

QUOTE(fillalph @ Nov 25 2007, 01:07 AM)

Hello Everyone,

I have uploaded my VI along with a picture of what the output is at the end.

I am able to acquire data correctly, no problem with that. The problem I am having is that "Array_Editted" is empty (the 2nd sequence in my code isn't working properly). I tried to step through the code to see where the problem was, but that didn't help. When looking at the probe of array_editted, the values are greyed out.

Any suggestions would be greatly appreciated. I have a feeling I am going to feel like an idiot when I figure it out :S

Thanks :)

fillalph

Hi fillalph

your array edited is never initialised. so instead of replacing elements at first, you have to insert them. in your case i would rather initialise an array with -1 values. then the loop would replace some of them with i.

Link to comment

QUOTE(fillalph @ Nov 25 2007, 01:07 AM)

Hello Everyone,

I have uploaded my VI along with a picture of what the output is at the end.

I am able to acquire data correctly, no problem with that. The problem I am having is that "Array_Editted" is empty (the 2nd sequence in my code isn't working properly). I tried to step through the code to see where the problem was, but that didn't help. When looking at the probe of array_editted, the values are greyed out.

Any suggestions would be greatly appreciated. I have a feeling I am going to feel like an idiot when I figure it out :S

Thanks :)

fillalph

Hi fillalph

your array edited is never initialised. so instead of replacing elements at first, you have to insert them. in your case i would rather initialise an array with -1 values. then the loop would replace some of them with i.

Link to comment

Hi Gabi,

I wasn't able to implement what you were saying, but I did manage to get the code to work. I was curious if someone could help "optimize" the code. Having so many local variables seems like a waste. I don't really need to optimize the code for my application, I am more or less looking to learn.

Thanks,

fillalph

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.