I have a couple of *.csv files containing data from several experiments. From those, two columns shall be extracted each, to form a new list. This process shall be automated to collect all the data from all experiments of one series. For this I try to use an indexed variable a[i]. With Transpose and Array the desired list is created. But when I try to export my test case to a *.csv it contains those curly brackets and quotation marks (the first two lines contain strings). Within this forum a number of people suggested to use Flatten to get rid of the unwanted characters. This works but completely destroys the structure of the table, which I want to keep.
When I use Join on my testcase there are no brackets or quotation marks in the *.csv. But as far as I understand the indexed variables are better for my task since the number of experiments within the different series will change. This assumption is based on answers of the following thread: https://stackoverflow.com/questions/11783760/how-do-i-save-multiple-variables-with-an-iterated-name-in-mathematica
I suppose it might be "just" an issue with the data format. Because it looks like Mathematica is exporting the list instead of the values within the list itself. Unfortunately I can't figure out how to fix it.
Thank you in advance!
--Edit 1--
Here is a code example of my problem. I hope this helps better understanding the problem.
I'm importing the *.csv files to the indexed varibale, using colums 1 and 4.
heatcombarrayex[1] =
Part[
Import[
TemplateApply[NotebookDirectory[] <> StringTemplate[
newfilename <> "_``"][ToString[1] <> "-" <> ToString[1]]] <>
"\\" <> TemplateApply[StringTemplate[
newfilename <> "``"][ToString[1] <> "-" <> ToString[1]]] <>
"_devc.csv"],
All, {1, 4}];
Then I use Array to show all the entries of the indexed variable. For my testcase I use two entries.
heatcombarrayoutex = Transpose[Array[heatcombarrayex, 2]];
Then the data is exported to a *.csv again.
Export[TemplateApply[
NotebookDirectory[] <>
"heatcombarrayex.csv"], heatcombarrayoutex, "CSV"]
This shows the first four lines of the result (Also I realised that I forget to mention that the second column is also wrapped in qoutation marks.):
{s", "kW/kg"}","{"s", "kW/kg"}"
{Time", "hrrpum"}","{"Time", "hrrpum"}"
{0., 0.},"{0., 0.}"
{4.21, 0.033500582},"{4.21, 0.041624561}"
And this is how it should look like:
s,kW/kg,s,kW/kg
Time,hrrpum,Time,hrrpum
0.,0.,0.,0.
4.21,0.033500582,4.21,0.041624561
So the question is: How to get rid of those extra characters?
-- Edit 2 --
For the the test case I use two data files (which can be found via the added link). But I only posted the code to import file number one, since the code for the following is basically the same, just the number changes.
In Mathematica the heatcombarrayoutex
looks like this:
{{{"s", "kW/kg"}, {"s", "kW/kg"}}, {{"Time", "hrrpum"}, {"Time",
"hrrpum"}}, {{0., 0.}, {0., 0.}}, {{4.21, 0.0335006}, {4.21,
0.0416246}}, ...995..., {{4200., 0.}, {4200., 0.}}}
I have two example files included for importing, which can be found following this link
{s", "kW/kg"}"
and{Time", "hrrpum"}"
, these seem to have unbalanced quotes, is that intentional? A full example with input, code and in error output, plus desired output, would help. $\endgroup$