Getting MatLab to Work on Your Personal Computer
Many of us need MatLab for miscellaneous classes. Unfortunately the student version of MatLab requires a license which costs ~$100. Fortunately Tech can provide this through their computer labs but it’s not always very convenient.
There is a way to utilize MatLab from the comfort of your own computer as a Tech Student. In this mini-tutorial I will show you how to do just that.
NOTE: I am not responsible if you break something. It’s unlikely, but I’m not claiming any responsibility.
Contents:
0. Issues and Limitations
First off, there are some minor limitations and issues to using this process.
- All of the files will be located on the school server.
- Copy and Paste will have some limitations. The hot-keys are not the same and copying from the client to the host and vice-versa.
- Window resizing may have some issues depending on which operating system you are using.
- It can be slow. If you are located off campus, then the network speed may be an issue.
If you are interested in how this works, check out section 3. If you need immediate MatLab access when the labs are closed and on holidays, you can get 24⁄7 access in the Fidel Computer Pod and the Gold lab by going to Gold and asking the front desk to get your key encoded.
1. Some Software Basics
You will need to know your 900-number, and the password you use to access your computer network account with the ITC. Some basic knowledge of how to SSH would be helpful, but if that doesn’t sound familiar -don’t worry.
You will also need some software:
MacOS
To run this program you will need a software called XQuartz.
- Install the software XQuartz by downloading the .dmg file to your Mac and following the instructions to install it. The program will ask for your password to install.
- To run the program go to your application LaunchPad/AppDrawer > Other > XQuartz or if still using Mac OSX LaunchPad/AppDrawer > Utilities > XQuartz
- The program will pop up and load a terminal window where you will now SSH into your ITC account. Jump to the next section for that.
Windows
To run this program you will need a software called Xming.
- Install the Xming X Server for Windows software by downloading .exe file and follow the prompts.
- Install the software PuTTY (select 32 or 64-bit .msi Windows Installer) and follow the prompts for that program too.
- Open PuTTY and make sure Xming is running (just Xming, ignore XLaunch). If you can’t tell if Xming is running, show the hidden icons on the taskbar. Now jump to the next section for logging in.
Linux
- Linux is pretty easy. Just open your terminal and then continue to the next step.
2. Let’s get to MatLab
We have to use a protocol called SSH to log into the ITC accounts and this is where the 900-number and your password come into play. If you don’t know either of those, please see the front desk in Gold or email help@nmt.edu. If you care as to why MatLab showing up on your screen works and want a brief explanation, then check out section 3, else continue reading on.
We will be using ITC’s ‘login’ server since ‘rainbow’ has been down for… a while. (apparently it now lives.)
So onto the useful part.
MacOS/Linux
- MacOS and Linux are very similar. In MacOS you need to open XQuartz if you haven’t already. XQuartz should open a terminal window with “xterm” in the top bar. If it doesn’t, right click on it in the dock and select
Applications
>Terminal
.
Note: Just stay in the standard terminal if using Linux or if you don’t want the GUI on Mac and skipped the software basics section above.
- Now for both Linux and MacOS/OSX type the following into the terminal window, where the 900-number is replaced with your own:
ssh -X 900123456@login.nmt.edu
- When you first login, you will be asked to check the authenticity of the host. This will be a long collection of seemingly random letters and numbers like below:
SHA256:zf3duw+GLORdfeK401r2pI1FcBndDbRwwztXEjDWzLU
- It should match one of the codes listed here. If they match or you don’t care one way or the other, just type out
yes
and pressenter
. You will not have to go through the random letter/number thing next time you login. Next, you will be prompted with entering your password like below:
900123456@login.nmt.edu's password:
NOTE: Don’t worry when you don’t see anything when typing your password. It’s not broken, it’s just a security thing.
- Now you are finally logged in and can start MatLab by typing
matlab
into the terminal, and pressingenter
. It may take a few seconds to load up, but it should now appear on your screen as if you have MatLab running on your computer.
Windows
- Open up PuTTY and make sure Xming is running.
- On the side bar, under
Connection
, click the plus button next toSSH
, and selectX11
. Click the check-box next toEnable X11 Forwarding
.
NOTE: In my experience, you have to enable X11 forwarding each time you open PuTTY. There’s a way to preserve settings but I don’t use PuTTY so I have not delved into this.
- On the side bar, select
Session
and enter the following into theHost Name (or IP address)
field, replacing the 900-number with your own:
900123456@login.nmt.edu
Now you can click open and a black window will pop up. The first time you connect, you will prompted to verify that you are connected to the correct host. It will have a garbled collection of letters and numbers which is the fingerprint of a key, rather than the key… and as long you typed in login.nmt.edu correctly it is probably fine so click
yes
.In the terminal window that was created by PuTTY, just type
matlab
and in a few seconds MatLab should now be working on your computer.
3. Why This Works
You’re still here? It’s Over. Go Home. Go. Basically window forwarding is a software package/mechanism that allows you to utilize the SSH (Secure Shell) network protocol to view the GUI window of the program running on the host computer on the client side. The latency is not great if you are half-way across the world, but for our purposes it will work okay.
Fortunately for us, by using the -X
or -Y
flag when creating an SSH tunnel between NMT’s ITC and our own computers will allow us to use X11 forwarding and view an already licensed MatLab technically running on Tech’s servers. Because the program is running on the server and not our own computer, all of the files you open and access are located on the server itself. I would recommend learning how to access the files you are using with SCP, SSHFS, or SFTP.
A side note: If all of this looks to daunting and you are comfortable with just the console, you can SSH into the server, and run MatLab via the matlab
command. This will open just the MatLab console which has all the functionality without the interface.