# STM32 Cubemonitor and saving data to .csv (excel)

**URL:** <https://discourse.nodered.org/t/stm32-cubemonitor-and-saving-data-to-csv-excel/50727>\
**Category:** General\
**Created:** [7 September 2021 22:44 UTC](https://discourse.nodered.org/t/stm32-cubemonitor-and-saving-data-to-csv-excel/50727 "2021-09-07T22:44:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RistoJT](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@RistoJT](https://discourse.nodered.org/u/RistoJT)\
**Post date:** [7 September 2021 22:44 UTC](https://discourse.nodered.org/t/stm32-cubemonitor-and-saving-data-to-csv-excel/50727/1 "2021-09-07T22:44:35Z")

</div>

Hello all,

I'm using STM32CubeMonitor which is Runtime Variable Monitoring tool and allows non-intrusive debugging off STM MCU's.

Cubemonitor is really nice tool in SW debugging and so far I have just used it to look variables in real time using chart or other dashboard objects.

Now I would really need to log data to a file, but I have troubles to get reasonable format to .csv file and since CubeMonitor is based on Node-RED I thought to ask advice from here.

This is my flow

 ![Flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0d9a50839d5feb0aee037feaebfe94e45c3fee0c.jpeg)

Now if I just save the msg.payload using "File" object I get data file like this.

 ![Raw data](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fbd1d7e0435ff7b02556c072cb6cc84193eb3b1d.jpeg)

First 7 rows show the names of variables that CubeMonitor is reading from MCU.  
So each variable has it's own line and for new data point there is data pair ("y":value , "x":timestamp) and are few of these data points in every line, so the format is example:

Variable1 [{y1:value,x1:value},{y2:value,x2:value},{y3:value,x3:value}...  
Variable2 [{y1:value,x1:value},{y2:value,x2:value},{y3:value,x3:value}...  
Variable3 [{y1:value,x1:value},{y2:value,x2:value},{y3:value,x3:value}...  
Variable1 [{y11:value,x11:value},{y12:value,x12:value},{y13:value,x13:value}...  
Variable2 [{y11:value,x11:value},{y12:value,x12:value},{y13:value,x13:value}...  
Variable3 [{y11:value,x11:value},{y12:value,x12:value},{y13:value,x13:value}...

Now this kind of format is really hard to process and I would like to get each variable into it's own column and also now each variable has it's own timestamp which is really not needed so I would prefer example put timestamp from one variable to column A and then variables values to columns B...H.

So far I have tried to pass that data through "csv" object with different setting and also I have tried to reformat the data using "Function" object but I was not able to get data to a format which I could work with example draw charts etc.

So now I'm asking some advice and would prefer some example how to get this working.

I would also be interested to know how to save example only every 10th data point, since cube monitor can be reading new data from MCU 100...200 times every second.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 November 2021 22:45 UTC](https://discourse.nodered.org/t/stm32-cubemonitor-and-saving-data-to-csv-excel/50727/2 "2021-11-06T22:45:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
