04-17-2025 10:03 AM - edited 04-17-2025 10:35 AM
@nrcan wrote:
Not sure why the picture didn't come through inline with text.. so try 2. I need to append a 1d array to a 2d array, BUT the 1D array is coming out as a column, not a row, See pic below..
You have two 1D array inputs and what is labeled as "what I have" is actually "what you currently get". And since that "tail array" is the excess part of the longer 1D array, it seems silly to first clip of off, then insert it again.
My first code skips all that detour!
Now, if you actually start out with the short 2D array and a 1D array to be appended to column 1, that would be a different problem that is almost equally easy to solve. So what are the actual inputs (A: 2x 1D arrays or B: a 1D and a 2D array?). If case B, you should reformulate the problem so the example actually has these inputs.
To avoid confusions, your example should have exactly two array inputs and one output.
Here are some ideas.... (LabVIEW 2019. Note that I also removed the trailing \n from input 1)
There are many other ways to assemble the parts, of course. The best method depends on how general a solution you want. For example if these arrays are gigantic, and the short 2D array had many columns and you want to append to a specific column, other versions might be more suitable.
04-19-2025 02:01 PM
@nrcan wrote:
I know a 1D can't be transposed.. but it needs to be to add to the existing. as in the image.. as I am saving to txt then opeing it in excel and i need Array 1 LONG and Array 2 to be beside each other.. All data and Important data. both in the same sheet.
just some trivia: you can transpose a 1d (matrix)...but only for numeric datatypes, no strings....
04-19-2025 02:54 PM
A matrix is always 2D, even if it only has one row or column. 😄
(A LabVIEW matrix is also limited to DBL and CDB, a very small subset of numeric datatypes.)
Also note that transpose matrix always reorders the elements while "transpose 2D array" might only tag it as transposed while not touching the data in memory. Both work on matrices and 2D arrays without coercion. Just tagging is often faster but can also cause performance issues downstream, for example when autoindexing on a large 2D array, because "row" elements are actually "column" elements and not adjacent in memory.
In fact, we actually have three function (array, matrix, linear algebra) that basically do the same, but in different ways.