Hi @Patrick,
I saw your question regarding the deprecation of `instrreset` in MATLAB R2025b, and I wanted to provide some insights based on the new recommendations. It seems that the removal of `instrreset` is a bit of a pain, especially if it’s been your go-to method for resetting your Picoscope 5444D. But no worries, there is work around in the newer MATLAB versions, you will need to manually manage the connection cleanup instead of relying on `instrreset`. The general workflow would look like this:
1. Stop any asynchronous operations: If your code is running asynchronous tasks (like data capture), you need to ensure those are stopped.
if strcmp(icdev.Status, 'open')
stopasync(icdev); % Stop any async operations running
end2. Close the connection: Use `fclose` to disconnect from the Picoscope.
fclose(icdev); % Close the connection to the Picoscope
3. Delete the instrument object: This will disconnect the device from MATLAB and free the associated resources.
delete(icdev); % Delete the object, disconnecting the device
4. Clear the object from the workspace: Finally, remove the object reference from the workspace to ensure that it's completely cleaned up.
clear icdev; % Clear the object from the workspace
Here is full example
% Assuming icdev is your Picoscope device object
% Stop asynchronous operations if any if strcmp(icdev.Status, 'open') stopasync(icdev); end
% Close the connection fclose(icdev);
% Delete the device object and disconnect from the instrument delete(icdev);
% Clear the object from the workspace clear icdev;
This sequence should provide the same functionality as `instrreset`, effectively resetting your Picoscope. Now, if you need to reset all connected devices (similar to `instrreset`'s old behavior), I’ve also created a small helper function that will loop through all connected devices and clean them up. Here’s an example:
function resetAllInstruments()
% Find all connected icdevice objects
devices = icdevicefind('PicoScope'); % Adjust with your specific device name
% Stop async, close, delete, and clear each device
for i = 1:length(devices)
if strcmp(devices(i).Status, 'open')
stopasync(devices(i)); % Stop async if needed
fclose(devices(i)); % Close the connection
end
delete(devices(i)); % Delete the object
clear devices(i); % Clear it from the workspace
end
endYou can call this whenever you need to reset all connected Picoscope devices at once. It’ll handle everything for you.
Let me recap, instrreset is being phased out, but you can still reset your Picoscope using `stopasync`, `fclose`, `delete`, and `clear`. The steps I’ve outlined should work seamlessly in the upcoming versions of MATLAB.
Hope this helps!
