We recently updated the Moku:Lab firmware so that it now uses the same API as Moku:Go and Moku:Pro. Have you recently updated your Moku:Lab firmware to 580? If so then it will use the moku-MATLAB toolbox which should work for both devices given the code you posted above (except of course changing the IP address). If not, then it will use the legacy MATLAB toolbox which you can download from here under the Legacy section.
Can confirm which firmware both devices are on to see if there is an issue with the API toolbox version?
I just updated the firmware to 580.
I ran the same code with the new firmware and the same moku-MATLAB toolbox, and I got a different error message:
Error using Moku/load_instrument_resources (line 323)
Cannot find bitstream C:\Users\xxxx\AppData\Roaming\MathWorks\MATLAB
Add-Ons\Toolboxes\moku-MATLAB\data\moku20\01-000, please run moku_download(580) to download
Error in MokuOscilloscope (line 87)
Error in MokuPhaseExmaple (line 17)
m = MokuOscilloscope(ip, force_connect='True');
Then, I uninstall the toolbox and installed the legacy MATLAB toolbox.
It got a different error message for the Moku:Lab and for the Moku:Go:
Error using moku/check_compatibility (line 172)
input file does not exist
Error in moku (line 71)
[compat, py_vers] = obj.check_compatibility();
Error in MokuOscilloscope (line 36)
Error in Test (line 10)
m = MokuOscilloscope(ip);