02-11-2020 07:35 AM
Hi all!
I have one 1D array of string and two 1D arrays of doublee.
I need to export it in excel or in a txt file.
in the first column i want the array of string and the two arrays of double in the adjacent columns.
Solved! Go to Solution.
02-11-2020 07:46 AM
You will need to format your 2D array of doubles into strings.
Then place the 1-D array of strings ahead of it.
If you do it with Build Array, you'll need to do a transpose of the 2-D array before and after.
Or you could do it in a loop so it appends an element of the string array to a row of the 2-D array (auto-index both tunnels) and it will do it row by row.
02-11-2020 07:46 AM
And where is the problem?
What you want is pretty basic (did you do the courses?), but without knowing where you fail, it's going to be either more lengthy than needed, or so generic it won't help much.
Convert the numeric arrays to text.
Build a 2D array.
Either write to file in a double loop, or
Convert to string (2D Array to Spreadsheet String) and write it to file.
(Pretty much infinite) variations are possible...
02-11-2020 02:17 PM - edited 02-11-2020 02:21 PM
I tried but there are allways problems.
someone can help me showing me the block diagram?
the first column has to be the array "filenames" the second has to be "array min" and the last "array max".
02-11-2020 02:29 PM
@Gquadro wrote:
I tried but there are always problems.
Then show what you have tried and tell us what is wrong with it. We are much more likely to help you debug than to just give you code and you learn nothing.
02-12-2020 03:44 AM
@Gquadro wrote:
I tried but there are allways problems.
someone can help me showing me the block diagram?
Not sure if it's 'the' block diagram, but it does what you described:
Like I said, there are tons of variations, and the best fit will depend on requirement details...
02-12-2020 07:25 AM - edited 02-12-2020 07:25 AM
this is what I tried but I obtain all the informations in one cell...
02-12-2020 07:33 AM
Your format string makes little sense. If you are saving a text document that will be understood by Excel, then you need a tab between each of your columns. I am seeing you trying a literal '\' followed by a 't' and then spaces. Change your format string to be "%s\t%f\t%f\n". This will format a string, followed by a tab, a floating point number, followed by a tab, another floating point number, and finally a Line Feed character.
02-12-2020 07:39 AM
And how can I do to to change row?
I want to obtain something like this:
String1;Double1of the first array;Double1 of the second array
String2;Double2of the first array;Double2 of the second array
02-12-2020 08:37 AM
@Gquadro wrote:
And how can I do to to change row?
I want to obtain something like this:
String1;Double1of the first array;Double1 of the second array
String2;Double2of the first array;Double2 of the second array
That is hard to advice on without knowing exactly what is wrong. The code that you show does exactly what you programmed it to do. Apparently that doesn't match what you require it to do, so what (exactly) is the current problem.
What is 'the first array' and what is 'the second array'? The wires cross each other and are all over the place.
What is the result you are getting now? Note that we don't know what the data is that you feed into the algorithm.
Rotating an array with the size of the array is a no-op.
Wiring the "N" of the for loop doesn't do anything. Auto indexing will automatically determine the nr. of iterations. This makes me think the problem is in the array sizes though. Are the file array, 1st array and 2nd array the same size? If not, the for loop will loop smallest size. If you don't want that, specify what you do want.