Thanks man
but now I have another problem... does that bother you?
I have this code where i want to sum up the more complicated arrays.
[{"id":"7f7e006e.6b431","type":"function","z":"69fd5631.e3f32c","name":"Calculate mean","func":"// Width and height of heating fields in pixels\n// dependant on the distance between camera and object\nconst FIELD_WIDTH = 2;\nconst FIELD_HEIGHT = 2;\n\n//WIDTH Resolution of Image\n//unused\nconst RES_WIDTH = 12;\n\n// # of heating fields to calculate\nconst FIELDS_HORIZONTAL = 4;\nconst FIELDS_VERTICAL = 6;\n\n// start at left upper corner\nconst HEATING_FIELD_START_HORIZONTAL = 0\n\n// start at left upper corner\nconst HEATING_FIELD_START_VERTICAL = 0;\n\n\ninputArray = new Array(msg.payload.length);\n\n//the payload is an array of objects, but an array of arrays is needed. \n//this loop creates an array of arrays for better handling\nfor(var n = 0; n < inputArray.length; n++){\n inputArray[n] = Object.values(msg.payload[n]);\n}\n\n\n//creating an empty outputArray with the set number of fields\nvar outputArray2 = new Array(FIELDS_VERTICAL);\n\nfor(var k = 0; k < outputArray2.length; k++){\n outputArray2[k] = new Array(FIELDS_HORIZONTAL);\n for(var l = 0; l < outputArray2[k].length; l++){\n outputArray2[k][l] = 0;\n }\n}\n\n\n\n//loop through the fields\n//runs through first row, then second, then third...\nfor(var v = 0; v < FIELDS_VERTICAL; v++){\n for(var h = 0; h < FIELDS_HORIZONTAL; h++){\n \n //calculate the median of each field\n var tmp = 0;\n \n for(var y = HEATING_FIELD_START_VERTICAL + v * FIELD_HEIGHT; y < HEATING_FIELD_START_VERTICAL + v * FIELD_HEIGHT + FIELD_HEIGHT; y++){\n for(var x = HEATING_FIELD_START_HORIZONTAL + h * FIELD_WIDTH; x < HEATING_FIELD_START_HORIZONTAL + h * FIELD_WIDTH + FIELD_WIDTH; x++){\n tmp += parseInt(inputArray[y][x]);\n } \n }\n //round to 2 decimals\n tmp = tmp / (FIELD_WIDTH * FIELD_HEIGHT);\n tmp = Math.round(tmp * 100) / 100;\n outputArray2[v][h] = tmp;\n \n }\n}\n\nflow.set(\"outputArray2\", msg.payload);\nmsg.payload = outputArray2;\n\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":120,"wires":[["d48e8e79.23e11"]]},{"id":"d48e8e79.23e11","type":"debug","z":"69fd5631.e3f32c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":930,"y":140,"wires":[]},{"id":"ca9abe43.08e73","type":"inject","z":"69fd5631.e3f32c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":140,"wires":[["fa7d0a6b.57f7c8","6da5596b.f5e328"]]},{"id":"fa7d0a6b.57f7c8","type":"file in","z":"69fd5631.e3f32c","name":"soll wert","filename":"\\\\bsh.corp.bshg.com\\fredirect\\DE\\GIN\\HoangT\\Desktop\\soll wert\\Mappe1.csv","format":"utf8","chunk":false,"sendError":false,"x":440,"y":120,"wires":[["d926ceff.7e151"]]},{"id":"d926ceff.7e151","type":"csv","z":"69fd5631.e3f32c","name":"Read csv","sep":";","hdrin":"","hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","x":580,"y":120,"wires":[["7f7e006e.6b431"]]},{"id":"6da5596b.f5e328","type":"file in","z":"69fd5631.e3f32c","name":"ist wert","filename":"\\\\bsh.corp.bshg.com\\fredirect\\DE\\GIN\\HoangT\\Desktop\\testcsv\\Mappe1.csv","format":"utf8","chunk":false,"sendError":false,"x":440,"y":160,"wires":[["ccfd7c5f.71fcc"]]},{"id":"ccfd7c5f.71fcc","type":"csv","z":"69fd5631.e3f32c","name":"Read csv","sep":";","hdrin":"","hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","x":580,"y":160,"wires":[["f2a18d8d.b226e"]]},{"id":"f2a18d8d.b226e","type":"function","z":"69fd5631.e3f32c","name":"Calculate mean","func":"// Width and height of heating fields in pixels\n// dependant on the distance between camera and object\nconst FIELD_WIDTH = 2;\nconst FIELD_HEIGHT = 2;\n\n//WIDTH Resolution of Image\n//unused\nconst RES_WIDTH = 12;\n\n// # of heating fields to calculate\nconst FIELDS_HORIZONTAL = 4;\nconst FIELDS_VERTICAL = 6;\n\n// start at left upper corner\nconst HEATING_FIELD_START_HORIZONTAL = 0\n\n// start at left upper corner\nconst HEATING_FIELD_START_VERTICAL = 0;\n\n\ninputArray = new Array(msg.payload.length);\n\n//the payload is an array of objects, but an array of arrays is needed. \n//this loop creates an array of arrays for better handling\nfor(var n = 0; n < inputArray.length; n++){\n inputArray[n] = Object.values(msg.payload[n]);\n}\n\n\n//creating an empty outputArray with the set number of fields\nvar outputArray2 = new Array(FIELDS_VERTICAL);\n\nfor(var k = 0; k < outputArray2.length; k++){\n outputArray2[k] = new Array(FIELDS_HORIZONTAL);\n for(var l = 0; l < outputArray2[k].length; l++){\n outputArray2[k][l] = 0;\n }\n}\n\n\n\n//loop through the fields\n//runs through first row, then second, then third...\nfor(var v = 0; v < FIELDS_VERTICAL; v++){\n for(var h = 0; h < FIELDS_HORIZONTAL; h++){\n \n //calculate the median of each field\n var tmp = 0;\n \n for(var y = HEATING_FIELD_START_VERTICAL + v * FIELD_HEIGHT; y < HEATING_FIELD_START_VERTICAL + v * FIELD_HEIGHT + FIELD_HEIGHT; y++){\n for(var x = HEATING_FIELD_START_HORIZONTAL + h * FIELD_WIDTH; x < HEATING_FIELD_START_HORIZONTAL + h * FIELD_WIDTH + FIELD_WIDTH; x++){\n tmp += parseInt(inputArray[y][x]);\n } \n }\n //round to 2 decimals\n tmp = tmp / (FIELD_WIDTH * FIELD_HEIGHT);\n tmp = Math.round(tmp * 100) / 100;\n outputArray2[v][h] = tmp;\n \n }\n}\n\nflow.set(\"outputArray2\", msg.payload);\nmsg.payload = outputArray2;\n\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":160,"wires":[["d48e8e79.23e11"]]}]
the csv files look like this (only with different numbers):
Would be nice if you could help me, thank you pretty much