LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fibonacci 2d array

Solved!
Go to solution

I was looking through the workshop files here:

 

https://decibel.ni.com/content/servlet/JiveServlet/download/21043-3-43168/Fibonacci.vi

 

I'm attempting to modify this file so that it is a 2d array. So if I attempt to add dimension to the one labeled "Fibonacci Sequence" it breaks the program since I beleive

the two aren't matching since there are elements that are in 1D right? So what I want to do is have user input for "n" but also have it show up in the fibonaci sequence first column so that it will be paired up to the fibonacci result in the second column. What ways can I do this? I'm drawing a blank.

 

I'm stumpted on how to get the userinput to show up into those columns of the 2d array.

0 Kudos
Message 1 of 19
(6,420 Views)

hello?

0 Kudos
Message 2 of 19
(6,412 Views)

Patience.  It is late on a Sunday night.

 

Why don't you attach your VI where you attempted to do what you are trying to do?

0 Kudos
Message 3 of 19
(6,408 Views)

sorry about that, anyway, I've attached what I wanted to get across, I'm just not sure how to link the n values to the fib numbers

0 Kudos
Message 4 of 19
(6,402 Views)

@LABVIEW321 wrote:

I'm attempting to modify this file so that it is a 2d array.


A fibonacci sequence is a 1D object. It is not clear at all what the second dimension should be in whatever you are trying to do.

 

If you just want a second column containing the index of the element of the fibonacci sequence, that seems trivial to do. What have you tried so far?

0 Kudos
Message 5 of 19
(6,400 Views)

OK, we posted at the same time. Simply add a build array before the autoindexing output tunnel and make an array of two element. Wire something derived from the iteration terminal to the other input of "built array".

0 Kudos
Message 6 of 19
(6,399 Views)

Another trivial change will ensure that the first 1 also shows. Did you find how?

 

(Officially, the sequence should start as 0,1,1,2,3,....  there needs to be a zero at the beginning.)

 

Your output needs to look as follows:

 

0  0

1  1

2  1

3  2

4  3

5  5

6  8

7 13

etc ...

0 Kudos
Message 7 of 19
(6,397 Views)

thanks for the build array tip, but no i haven't found a way to make the n input values show up in the first column. What am I missing?

0 Kudos
Message 8 of 19
(6,363 Views)

hello?, I've tried to make a for loop which I think would help make the inputs show up on the 2d array, but I think im not doign something right cause it affects the 2nd column, and both of them have the same numbers, so that cant be right

0 Kudos
Message 9 of 19
(6,352 Views)

Post your VI so we can see what you are doing.  There is no way we can guess in what way it is wrong without seeing it.

0 Kudos
Message 10 of 19
(6,340 Views)