Yes, this works. I run old software the same way. Here is the setup I use.
- Install Oracle VirtualBox on your Windows 11 PC.
- Create a new virtual machine and select Windows 7 (64-bit). Give it at least 4 GB of RAM, 2 processor cores, and a 40 GB virtual hard disk.
- Install Windows 7 in the VM from your installation media, then activate it with your Windows 7 Pro license key.
- After Windows 7 is installed, install Guest Additions from the Devices menu in VirtualBox. That gives you the correct screen resolution and shared folders.
- Install your old Matlab inside the VM.
Two things to check. First, turn on virtualization in your BIOS or UEFI settings if VirtualBox reports that it is off. Second, Windows 7 no longer gets security updates, so I keep a Windows 7 VM offline and I do not browse or check email inside it. Once Matlab is installed and working, take a VirtualBox snapshot so you can restore the VM if anything breaks.