Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts

Wednesday, June 26, 2013

Use git from Matlab

For those of you who are fans of both Matlab and git, you'll really like the following project: https://github.com/slayton/matlab-git (Matlab File Exchange page: http://www.mathworks.com/matlabcentral/fileexchange/38600-git-matlab).

Simply put git.m somewhere in your path and now you can use standard git commands (e.g. status, commit, pull, push) right from the Matlab terminal. I have personally found this quite handy.

Wednesday, June 19, 2013

Latest Java update (1.6.0_51 released on June 19, 2013) breaks Matlab

Today I updated Java on my Mac (running OS 10.8) to 1.6.0_51 which unfortunately broke my Matlab (R2010b) installation: I could open the application but I couldn't interact with the GUI in any way. It seems many other people have had this issue and I wanted to endorse the solution I used:
I found this workaround, should work until Apple/Mathworks issues a patch: 
Download the Apple Java SE 2013-003 update (no longer on the Apple website but I found this link:http://apple-java-for-mac.en.softonic.com/mac/download
Then download and install Pacifist http://www.charlessoft.com 
Use Pacifist to open the Apple Java package and install using the install option of Pacifist. 
Your Java SE should be downgraded to where it was prior to applying the 2013-004 patch. This worked for me, matlab is functional again. 
J
Source: http://www.mathworks.com/matlabcentral/answers/79489-java-1-6-0_51-breaks-matlab-2012b-and-below
Author: http://www.mathworks.com/matlabcentral/answers/contributors/4383739-julien-aubert

If you find this useful, please visit the source link and upvote Julien's answer.

For anyone who's curious or concerned, Pacifist is just a shareware (free trial) tool to let you install older versions of applications, bypassing any "safeguards" Mac OS has in place. The whole process was simple, easy, and much faster than Googling for other options (which I also did).

Friday, March 25, 2011

~ in Matlab: not just for NOT

When reading Steve's article on the irregular behavior of Matlab's size() function, I was reminded of a neat trick.

Frequently I call a function and only use one or two of its output arguments. In many cases I use the first couple of output arguments, but occasionally I want to use, say, only the second output argument. If I assign the first output to some variable, I now have a meaningless variable floating around, taking up space, and potentially causing problems. A much more elegant solution is to call the function like this:
[~, output] = myFunction(input);
In this way, the first output argument disappears while the second is saved to the variable output.

If you'd like, you can read articles on the same topic by Matlab geniuses Loren and Steve.

Matlab subplot


I often use Matlab's subplot function to plot multiple things in one figure, like this:

However, I recently discovered that you can have them span multiple rows or columns:

Note: all figures shamelessly stolen from http://www.mathworks.com/help/techdoc/ref/subplot.html, Matlab's subplot documentation.

Friday, February 18, 2011

Creative and beautiful pictures, delicious treats, and a MATLAB puzzle

Ordinary objects come to life


Take a look around the world from above


These red velvet cake balls look delicious!

MATLAB puzzle (solutions at link):

if (BLANK)
    disp('I Love ')
else
    disp('MATLAB')
end
What can replace BLANK to get the print-out (exactly): I Love MATLAB

And finally, how this blog is created (follow the link for the full-size comic and hovertext):

Sunday, February 13, 2011

Matlab publish()


The publish command is great because it lets me compile the output of a Matlab script into an HTML (or .doc, .ppt, .pdf, etc.) file that is nicely formatted. This way I don’t need to run the script again to get a quick reminder of what it did! I also use it to show results to my adviser. Learn more about it here.