# How do I separate and define two of my variables?

**URL:** <https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503>\
**Category:** General\
**Created:** [12 November 2022 18:10 UTC](https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503 "2022-11-12T18:10:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ceowens](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@Ceowens](https://discourse.nodered.org/u/Ceowens)\
**Post date:** [12 November 2022 18:10 UTC](https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503/1 "2022-11-12T18:10:11Z")

</div>

I have code that is outputting an x value, a y value, a max value, a radius value, and a theta value within my Raspberry Pi that updates every second.

An example output looks like this below:

```
Highest Number: 31.9029
x: -15
y: 8
Radius: 17.0
Theta: -28.07

```

What I'm trying to do through Node Red on my Raspberry Pi is output only the Radius value and the Theta value separately.

I simply did this to test for simply my radius value:

```
timestamp -- 
exec (My Python Script, while the command is running, spawn mode is enabled) -- 
switch node (contains "Radius") -- 
debug

```

But my output is showing different things almost every single time.

One output

```
Radius:

```

Another output

```
y: 8
x: -15

```

Another output

```
y: 8
Radius: 17.9
Theta: 30.96

```

It's all pretty ugly. Is there a way to get these outputs in a better way on Node Red?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:23 UTC](https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503/2 "2022-11-12T18:23:29Z")

</div>

You have the script, so you can modify what output it produces. Python can generate json as well, perhaps a bit easier to deal with in node-red. (parsing the output is also possible ofcourse)

---

<div class="post-metadata">

**Author:** ![Ceowens](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@Ceowens](https://discourse.nodered.org/u/Ceowens)\
**Post date:** [12 November 2022 18:56 UTC](https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503/3 "2022-11-12T18:56:35Z")

</div>

That does make sense. Thank you. It works great. I was scared because I'm using a thermal camera to gather this information and I didn't know if processing multiple code would be too much for Node Red or the Pi

---

<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:** [26 November 2022 18:57 UTC](https://discourse.nodered.org/t/how-do-i-separate-and-define-two-of-my-variables/70503/4 "2022-11-26T18:57:31Z")

</div>

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