https://www.how2shout.com/how-to/how-to-permanently-set-cpu-affinity-for-a-program-in-windows-11-or-10.html shows how to create a Windows shortcut that sets the processor affinity for a particular command. You could create one to start matlab on CPU 0 and another to start matlab on CPU 1.
It would not surprise me if there is a taskmgr command that could alter the affinity of a running process.