05-20-2016 09:04 AM
Hello,
Here is emulation of an extract of my testbed (where data should be saved into a file for postprocessing).
Here are keypoints:
The problem I've met in this example - the data in all columns are saved in floating point format (please, see the screenshot below)
How to save column_0 in integer format, other columns - in floating point ?
Thanks
Solved! Go to Solution.
05-20-2016 09:37 AM
You can't store in one array different data type (see red dot mean type cast). So you can form 2 arrays or before writing split array and convert dbl to int.
Also, why you use event-structure out of loop? Your code wil work without it.
05-20-2016 10:22 AM
Thanks
Indeed event struct it's useless.
Concerning split arrays I didn't properly understand what you mean.
If I split 2 arrays and convert column_0 to integer, then how to proceed further ?
In the example below I tried to format splitted arrays into strings, but unfortunately write block doesn't support strings
05-20-2016 10:30 AM - edited 05-20-2016 10:33 AM
Use "built array" instead of "concatenate string". This created a 2D array. transpose if desired. the file tool accepts 2D array of strings.
(A file is just a long 1D string, so to get better control, just format it all in memory, delimiters and all, and then write it to a plain text file.)
05-20-2016 10:30 AM
Even more simple - without FOR loop ... but still 1st column is formatted as float.
05-20-2016 10:40 AM - edited 05-20-2016 10:43 AM
I think this way to form array and string better.
When you use "insert into array" each iteration you waste memory and time
05-20-2016 10:47 AM
altenbach a écrit :Use "built array" instead of "concatenate string". This created a 2D array. transpose if desired. the file tool accepts 2D array of strings.
(A file is just a long 1D string, so to get better control, just format it all in memory, delimiters and all, and then write it to a plain text file.)
Build doesn't work (if I correctly understood your suggestion)
05-20-2016 11:04 AM
@Pavel_47 wrote:
Build doesn't work (if I correctly understood your suggestion)
Well, yes, it gets rid of the broken wire. 😄 I haven't studied what you really want. As I said, do all the formatting in memory to have full control, then just write a single plain string to a file. No need for fancy highlevel IO.
05-20-2016 11:06 AM
Artem.SPb a écrit :I think this way to form array and string better.
When you use "insert into array" each iteration you waste memory and time
Ok, thanks.
05-20-2016 11:38 AM
@Artem.SPb wrote:
When you use "insert into array" each iteration you waste memory and time
It's not with every iteration. Also "built array" does the same thing so there is no difference.