I'm looking for a portable solution to using matlab on any computer.I tried to install matlab on the hdd and found that it wouldn't work on other computers. What can I do to make it work? Is it even possible?
Unless you are part of a large organization that can justify the cost of a concurrent licence, then no, it's not possible
A Concurrent license enables you to make MathWorks products available to anyone with access to your network
It is possible.
You can find many examples of windows versions of MATLAB that were made portable on the internet. Such a portable version can be used from a mobile Hard Disk (not simply a flash memory, since they are multigigabyte to host a complete MATLAB --- all toolboxes and simulink).
It would be legal if whoever makes it is the legitimate owner of a license(s) for MATLAB products.
It would be illegal if this is not the case and the portable MATLAB is downloaded for free from the internet.
Making programs portable may be easy or even extremely difficult: it is never impossible and it is completely out of the control of the publisher.