LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Could anyone help me to tell that how can i save 100-200 equally spaced values of a particular number%3F

Solved!
Go to solution

Could anyone help me that how can i save 100-200 equally spaced values of a particular number in labview?. Lets suppose i have a number of 50 and i need 100-200 equally spaced values between 0 to 50. I made a sample program but it gives memory storage error that i couldn't understand how to solve it....

0 Kudos
Message 1 of 11
(2,519 Views)
Solution
Accepted by topic author Essamuddin

You are making the mistake of doing equal comparisons on floating point numbers. This is very dangerous. Most likely, your VI will never stop until the computer runs out of memory. Replace the "equal" with "greater or equal" and you should be OK.

 

Since you know the number of iterations beforehand, you should use a FOR loop. See how far you get. Also, your shift register should probably be initialized.

 

(Of course, there is also "ramp pattern" if you want a canned solution. ;))

0 Kudos
Message 2 of 11
(2,516 Views)

Thanks. it works....

though i m new to labview so i didn't understand your last note about ramp pattern and canned solution...

0 Kudos
Message 3 of 11
(2,496 Views)

He was referring to the Ramp Pattern.vi in the Signal Processing >> Signal Generation palette.  It can do everything you want in one VI provided by NI with LV, hence "canned solution."

 

Lynn

0 Kudos
Message 4 of 11
(2,491 Views)

Essamuddin wrote:

though i m new to labview so i didn't understand your last note about ramp pattern and canned solution...


A canned solution is like e.g. a can of soup, ready to heat and serve (like the ramp pattern function) while you could alternatively go to the farmers market, buy all ingredients, and make a soup from scratch. (similar to what you are trying to do with your program imitating the ramp function. :D)

 

Arguably, your home-made soup will probaby be better and have fewer questionable ingredients than the canned version. On the other hand, the ramp pattern from NI is a highly tuned and efficient piece of coding that will most likely beat any of your own attemps in terms of speed and memory efficiency. 😉

 

What is the purpose of all this? Do you simply need a ramp or are your trying to learn how to use loops and such in general?

0 Kudos
Message 5 of 11
(2,485 Views)

Thanks once again for your valuable response.....

 

Actually i am trying to implement a small code in Labview. and i have to use these ramp like values to find another corresponding vector values through some mathematical equations and loops. I tried to make a program so could you help me in finding the errors and mistakes that i did in the attached file. The code and the resultant graph is attached.

 

Download All
0 Kudos
Message 6 of 11
(2,451 Views)

The for loop executes zero times. Why? Because the number of iterations is the minimum of N or the length of an autoindexed array input.  Generally you should not both wire N and use autoindexing inputs.  You have an empty array constant wired to the for loop so it executes zero times.

 

I think this may be your B vector. Use Initialize Array to create an array with a specified number of zero value elements.

 

Lynn

0 Kudos
Message 7 of 11
(2,446 Views)

By initializing array for B vector the for loop runs for 100 iterations but at the output B vector has only two last values... Seems it updates the values with new one after two iterations instead indexing new values??....

0 Kudos
Message 8 of 11
(2,433 Views)

You'll have to post your latest VI so we can see what might be doing that.

0 Kudos
Message 9 of 11
(2,424 Views)

The indicator terminal for the B-Array is outside the for loop and the tunnel is set to Last Value (non-indexing). So it displays only the value from the 100th iteration of the for loop.  If you change that tunnel to indexing, then you get a 2D array with 100 rows and 2 columns. The value in the second column is either the same as the value in the first column or zero. The values start at about 4.5 and decrease to -48.2.  The zeros appear to result from the while loop stopping after the first iteration.

 

Lynn

0 Kudos
Message 10 of 11
(2,415 Views)