LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to record the output and put all values into a array, but fail to do

Solved!
Go to solution
Highlighted

I listed in the picture, when i hit run, no error, but I didnt get anything, what's my logic pitfall ? 😞

Download All
0 Kudos
Message 1 of 8
(1,112 Views)
Highlighted

It appears that you are using Replace Array Subset (which is good), but the array you are replacing (Output) is empty. Replacing an element in an empty array has no effect.  From the Detailed Help for Repalce Array Subset:

 


If any index is negative or larger than the corresponding dimension in n-dimension array the function has no effect.


 

 

Initialize Output to be the same size as Input Array or to have 11 elements, whichever is smaller. If you move Input array to the right of the for loop and use autoindexing, the Index array is not required.  If Input Array and Output Array will always be the same size, you do not need Output at all. Initialize the array outside the loop and wire it to a shift register.

 

I am not sure what you are doing but a graph might be more appropriate than a chart since you write the complete array on each iteration.

 

Lynn

0 Kudos
Message 2 of 8
(1,096 Views)
Highlighted

thank you, to use Replace Array Subset, I have to unitialze values, before that, all values are gray, but now, thing is worse or I should say i didnt know how to eliminate my Output array and replace it with shift register...T_T

 

 

0 Kudos
Message 3 of 8
(1,079 Views)
Highlighted
Solution
Accepted by topic author ivy037

Here is the way to connect it via a shift register.  Note that I also moved Input Array outside the loop and used autoindexing. I also used Initialize Array rather than an array constant.  There is nothing wrong with using an array constant, but using Initialize Array allows the program to adapt to the size of Input Array.

 

As noted on the diagram I could not hook up the data wire from the Fuzzy Controller.vi because I do not have that subVI.  You will need to make that connection before you test.

 

Lynn

0 Kudos
Message 4 of 8
(1,071 Views)
Highlighted

This is called professionalism. Compare my code with yours, I feel I have a long way to go....

 

thanks, Lynn, but last question, I redo everything according to your code and hit run, the output is all zero... This is weird. If my fuzzy system is not that good, it cannot be all zero, no?

 

Also, every time I open the code, I need to manually initialize all values in the input array, this is annoying. Can LabView remember all my values? In Matlab, All I did is just write input = [7 5 6 7 8 5 3 4 5...etc]

 

0 Kudos
Message 5 of 8
(1,063 Views)
Highlighted

Context-click on the Input array control on the front panel and choose Make Current Values Default from the pop-up menu. Then save the VI.  That will preserve the data.  You can still change it manually any time you want to run with different data.

 

Your code is not bad.  I have seen much worse.  If you have not done so, I recommend that you spend the time to work through the on-line Getting Started tutorials.  Also check out the LV Style Guide.

 

Lynn

0 Kudos
Message 6 of 8
(1,027 Views)
Highlighted

Make Current Values Default ---- I learned another technique!!

 

Thank you!!

0 Kudos
Message 7 of 8
(1,012 Views)
Highlighted

Tip 1: While programming, always keep the Context Help window visible.  It has lots of useful information.

 

Tip 2: Explore the menus.  You might be surprised at what you can find there.

 

Lynn

0 Kudos
Message 8 of 8
(1,007 Views)