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: 

Append two arrays, without a while loop

Solved!
Go to solution

I have two arrays - sizes 1 X 5 and the other 1x6

 

I wanna make it 1X11 - with out a while loop

 

Both the 1X5 and 1X6 arrays are subset arrays - taken from two larger arrays of size (1X8 each)

 

As of now, I am using insert into array vi  ( with insert index at the end) and it is giving weird outputs.I am unable to append two arrays and get a 1X11. 

 

 

0 Kudos
Message 1 of 19
(6,103 Views)
Message 2 of 19
(6,094 Views)

A few comments:

  • What's the point about no "while loop"? A while loop is probably the last thing that comes to mind when trying to solve this. Please leave irrelevant points out of the post, they just distract from the main question. (Did you find a solution using a while loop? I'd love to see that! 🐵
  • When posting a question it is always recommended to attach a small VI. This way we can show you the solution directly.
  • If you say 1x5 or similar, you are talking about 2D arrays with either one column and N rows or one row and N columns. It would make more sense if you would have 1D arrays (one size=5 and one size=6). Are you going to use the second dimension later? Why is it there, complicating things? Again this would have been much clearer if you would show your code, because the solution critically depends on it. Without information about dimensions and arrangement (1D array, 2D array with one column, 2D array with 1 row, etc.), we cannot generically tell you what to do.
  • When attaching your code, please fill typical data into your controls and make them the default before saving. Then tell us what result you would expect. This way we have something to play with.

 

 

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

Altenback,

 

Since you are asking my code, I am attaching my code - good luck wasting your time with it. 

Now you would probably ask to just give me a simple version, so I am attaching that too ( see my second VI) - Now I would be skeptic about your solution, because you were unable to quickly produce this small code, based on my description. 

Everyone knows it is simpler with 1D, one does not need to state the obvious. Usually, one would know what he/she is talking about and it is good practice to assume he/ she does before judging.

Lastly, since you asked for default values in the code, I believe it is more time consuming to add that in DAQ and serial communication vi's, so if you think it is easy - please go ahead. I believe my second VI should be very useful for you to play with.

 

If you still have questions, ..............

Download All
0 Kudos
Message 4 of 19
(6,070 Views)

Hooovahh

 

It won't work, because it is a 2D array.

 

"If you are new to LabVIEW there's lots of free training to checkout, this should be covered in the basic training" - Now you know who it applies to

 

 

 

0 Kudos
Message 5 of 19
(6,067 Views)
Solution
Accepted by topic author looser_engineer

Try transposing both arrays first.

0 Kudos
Message 6 of 19
(6,064 Views)
Solution
Accepted by topic author looser_engineer

Oh my, you must be new around here.  You see we are volunteers helping people in our free time.  Most people on the forums (yourself included) don't provide enough information, which leads to assumptions.  Lots of them.  As Altenbach put it very clearly you could interpret what you said many different ways, as I did because I made an assumption based on the lack of information you provided.

 

If you ask a question poorly, expect a poor answer. Here is a fun little page that might help you ask questions better in the future.  Also feel free to read up on this post where it asks you post code, give as much details as possible, and give example data on what you want.

 

Had I known you were talking about a 2D array of doubles I would have told you to use the Build Matrix function which has a right click option to append by row or column but that information was missing.

 


@looser_engineer wrote:

It won't work, because it is a 2D array.


Great, mention that in your first post, or in your title and I wouldn't have had to make any assumption.  You just helped prove my point.

 


@looser_engineer wrote:

"If you are new to LabVIEW there's lots of free training to checkout, this should be covered in the basic training" - Now you know who it applies to


If you have something to teach me I'm always willing to learn.  I've been doing LabVIEW daily for many years now and would be glad to hear what you have to say.  But honestly your posts are coming across as very abrasive, and negative.  We all have bad days, and we try to not take things personal, but again we do this in our free time instead of doing other hobbies, so when someone posts in a negative way we tend to have a knee jerk reaction to start name calling.

Message 7 of 19
(6,062 Views)

Also, your initial question was slightly unclear that you were referring to 2D arrays - I at first thought by 1x6 you meant a 1D array. After seeing your code and reading over it again, I understood what you meant, but in general that is one reason we ask to attach code. Communicating over the internet is hard and sometimes saying things twice (in writing and in code) might feel repetitive, but it actually helps us help you better and makes things easier.

Message 8 of 19
(6,059 Views)

I noticed you marked mine as solution, but I would actually recommend Hoovah's suggestion of using the Build Matrix function. He is more of an expert than I am 🙂 and I think that solution is actually simpler. 

Message 9 of 19
(6,044 Views)

Not just yours, I marked both as solutions

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