From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1D-array - DBL

Hello, I'm a new Labview user and have problem to figure out a solution.

 

I want to create an 1D-array with this pattern: N,3 N,5 N,7 N,9    where N stands for any value the user chooses.

 

For instance, if I choose N=1 the output of 1D-array should look like this "1,3 1,5 1,7 1,9"

 

N=4    "4,3 4,5 4,7 4,9" and so on...

 

Got the tip that the solution should contain 2 nested FOR-loop, Shift Register and Build Array(s) but can't get it working.

 

 

 

0 Kudos
Message 1 of 6
(2,578 Views)

Homework time again? 😄

 

What is the meaning of "and so on...". What determines the highest value? Is the number of elements alway an even number?


@Day_Trader wrote:

Got the tip that the solution should contain 2 nested FOR-loop, Shift Register and Build Array(s) but can't get it working.


What kind of "tip" is this? Who gave it? Is the solution required to have all this or is it sufficient if the result is correct?

In any case, all you need is a single FOR loop (not two) and you don't need a "built array" or shift register at all. Try it!

 

Feel free to attach your failed attempts and we will tell you what's wrong and how to make it better.

0 Kudos
Message 2 of 6
(2,572 Views)

Why does it have to be DBL (according to your post subject line), it all intergers in your example.

 

In any case, try to figure out why this works: 😮

 

 

0 Kudos
Message 3 of 6
(2,561 Views)

Sorry if I was unclear.

 

I attached the .vi which isn't working. The only time it is working is when I choose N=4. When choosing:

 

N=3 I get [3,3  3,5  3,7] (element 3,9 is missing)

 

N=2 [2,3  2,5]               (elements 2,7 and 2,9 are missing)

 

N=5 [5,3  5,5  5,7  5,9  6,1]  (only first 4 elements are needed)

 

 

The maximum value isn't determined and only 4 elements is required.

 

For instance,   (N,3  N,5  N,7  N,9)

N=

0                     0,3  0,5  0,7  0,9

1                     1,3  1,5  1,7  1,9

2                     2,3  2,5  2,7  2,9

3                     3,3  3,5  3,7  3,9

4                     4,3  4,5  4,7  4,9

5                     5,3  5,5  5,7  5,9

6                     6,3  6,5  6,7  6,9

 

The "tip" is from my course instructor and i guess it is needed for the solution. (It is a practise thing I guess)

 

 

0 Kudos
Message 4 of 6
(2,517 Views)

You've confused things.

 

Are you actually dealing with COMMAS as your decimal point instead of an actual decimal point?

 

I though Altenbach gave you what you needed because your commas looked like part of a list separator.

 

Your problem is that you've wired the iteration counter of your outer loop to the N terminal of your inner loop.  Try just wiring a constant 4 to the inner loop's N terminal.

 

And you say you want a 1-D array, but your example output in the last post looks like you are trying to build a 2-D array.

0 Kudos
Message 5 of 6
(2,505 Views)

The quality of the answer cannot be higher than the quality of the question, and you are not really making a lot of sense so far. Can you quote the exact written problem description as given by your instructor?

 

Maybe something like this? 😮

 

 

 (Works for all non-negative inputs I tried :D. What result do you expect for negative N inputs)

0 Kudos
Message 6 of 6
(2,492 Views)