Hi,
I would like that at every step of my dynamic model an file with the architecture of the each plant is generated.
The following function does more or less the job, however, it is still very rudimental, and I would like it to be smarter, specifically in the section where I pull the information from each organ and put it in a row to be attached to the CSV.
Is there a way to specify the name of the header of the column to which a specific value should go?
static void exportMTG() {
// Set the output file, where the computed values should be stored
PrintWriter out = new PrintWriter(new FileWriter(PATH_EXPORT + MTG_EXPORT, false));
// Headers
String[] headers = new String[52]; // Size based on the maximum column index used
headers[column_ID] = "ID";
headers[column_order] = "order";
headers[column_rank] = "rank";
// Etc...
// Write headers to CSV
for (int i = 0; i < headers.length; i++) {
if (headers[i] != null) {
out.print(headers[i]);
if (i < headers.length - 1) {
out.print(",");
}
}
}
[
o:GrowingOrgan ::> {
///MY PROBLEM IS HERE BELOW: at the moment every new variable added need to be following the exact same order of the headers from the csv
out.println(o[ID]+","+l[rank]+","+o[order]+","+o[rank]);
}
]
out.flush();
out.close();
}
Or better: is there a way to export ALL the information for every organ in a simple way?