# Matlab start\_logging bug (normal vs precision)

**URL:** <https://forum.liquidinstruments.com/t/matlab-start-logging-bug-normal-vs-precision/1293>\
**Category:** Software & APIs\
**Created:** [September 22, 2026, 2:32pm UTC](https://forum.liquidinstruments.com/t/matlab-start-logging-bug-normal-vs-precision/1293 "2026-09-22T14:32:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan.tomlin](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nathan.tomlin](https://forum.liquidinstruments.com/u/nathan.tomlin)\
**Post date:** [September 22, 2026, 2:32pm UTC](https://forum.liquidinstruments.com/t/matlab-start-logging-bug-normal-vs-precision/1293/1 "2026-09-22T14:32:13Z")

</div>

I couldn’t get the ‘get\_stream\_data’ working in matlab (just saw [this thread](https://forum.liquidinstruments.com/t/data-logger-in-multi-instruments-mode/947)), so I’m using ‘start\_logging’ instead. It mostly works, except for one weird bug. This command works fine:

```plaintext
pid.start_logging('duration',10,'mode','Normal','rate',1e3)

```

(I’m using multi instrument and having the PID controller log) Polls using ‘logging\_progress’ all make sense, it says “Logging in progress” while it counts down 10 seconds, then says 0 seconds remaining and “Logging complete”. But this command does not work:

```plaintext
pid.start_logging('duration',10,'mode','Precision','rate',1e3)

```

In this case, it says “Logging in progress” while it counts down 10 seconds, but then says 0 seconds remaining and “Logging in progress” for another 10 seconds until finally reports “Logging complete” after 20 seconds and the file saved has 20 s of data, not 10 s. The time is always double when I choose precision.

If it matters, my versions are:

- mokucli: 4.3.0.0
- mokuos: 4.3.0
- matlab: 2024b (I could update if it would help)
- moku-matlab: 4.3.0

---

<div class="post-metadata">

**Author:** ![nathan.tomlin](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nathan.tomlin](https://forum.liquidinstruments.com/u/nathan.tomlin)\
**Post date:** [September 25, 2026, 5:55pm UTC](https://forum.liquidinstruments.com/t/matlab-start-logging-bug-normal-vs-precision/1293/2 "2026-09-25T17:55:12Z")

</div>

(editing multiple responses into one for clarity)

Everything works fine from the Moku app saving data manually, but there seems to be an issue with the API (matlab & python) getting precision data from the PID controller (multi-instrument mode, 3 slots, PID in slot 2). The problem is with ‘start\_logging’ and ‘start\_streaming’. The data returned is not precision, it’s normal mode data. It also takes twice the duration to capture.

When I pipe the PID output to a lock-in amplifier I have in slot 1, I am able to get precision data just fine from the lock-in. So the problem is just with the PID controller. I have only tested with 3 slots and the PID in slot 2 so I don’t know if moving slots would change anything or going to 3 slots or the dedicated PID.

---

<div class="post-metadata">

**Author:** ![PaulC](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.liquidinstruments.com/paulc/32/23_2.png) [@PaulC](https://forum.liquidinstruments.com/u/PaulC)\
**Post date:** [September 29, 2026, 12:44am UTC](https://forum.liquidinstruments.com/t/matlab-start-logging-bug-normal-vs-precision/1293/5 "2026-09-29T00:44:05Z")

</div>

Hi Nathan, thanks for your forum posting.

I can confirm this is a bug. Specifically, for the datalogger embedded within the PID instrument, the Precision acquisition mode does not function correctly; it returns twice the expected number of samples and it is indeed ‘normal’ mode data, not ‘precision’ mode data.

While we work to fix this issue, attached is a Python script that will sample data at a higher rate (100x) and then average this data locally - within Python - achieving same outcome as precision acquisition mode.

The diagram shows a (slightly) noisy sine wave that is improved by this method.

 ![PID datalogger normal vs local averaging](https://canada1.discourse-cdn.com/flex035/uploads/liquidinstruments/original/1X/99374c9748f6497d7246846dc413aa2cadc511cf.png)

Paul.

[pid\_datalogger\_normal\_vs\_averaged100.py.zip](https://forum.liquidinstruments.com/uploads/short-url/fB2e8piYLE7dWXBShoWtrCZuYtd.zip) (3.3 KB)
