ContentFull

Matlab and Snow Leopard Compatability

  • 8.28.09
  • Comments(6)

Matlab has been trying to catchup OSX for some time now. First releasing a rather bad version of Matlab for the Intel processor, and subsequently releasing a 64bit version. Both showed signs of commitment, however, today after installing Snow Leopard I was slightly annoyed that some of the functionality had become broken.

mmreader, which I depend on for reading avi movie files no longer works. Images seem to be garbled by some sort of offset and data conversion. I suspect this stems from some 32 to 64 bit conversion that Matlab is not aware of. Anyway, so now I can’t read movies files until they fix Matlab which god knows when it will be.

Update for those thinking of installing Snow Leopard: 2008a, 2009a, 2009b (32 and 64 bit) all work fine. Aside from some bugs that must exist like the one above in specific packages, the general Matlab environment is fully functional.

The great Matlab to Python Bridge

  • 8.23.09
  • Comments(0)

Currently Matlab is undergoing some major changes. While it slept for the past 5 years other programming languages have stepped up to take its place. Python, C++, Java amongst others have become as easy to use and as efficient as Matlab. The current  problem, however, is that not all projects and libraries exist in all these languages. So what happens when you have a great program in Matlab and a great program in Python and you want to tie the two together? Here is my experience this weekend:

Day 1: This will be great. I’ll use the Python C API to call python from Matlab. I’ll save the Python state as a Matlab variable and I can always start up my Python session where I left off.

Day 2: Alright.. maybe not. But let’s just try calling Python from C, I just want to make it work, not have it running efficiently.

Day 3: Ok, clearly Python has a crappy API. Moving to the client/server socket communication approach. Phew.. must it be this hard?

Matlab and movies

  • 8.10.09
  • Comments(0)

Animations of how 2D matrixes change over time can sometimes be helpful in detecting trends. Bellow is a small bit of code, very trivial, that converts a set of 2D matrixes to a avi movie.

% Images = set of 2D matrixes that we want to convert to a movie (values range from 0-255)
% Frames = Pseudo RGB version Frames
% Mov = Matlab structure that holds the movie
Width = 48; Height = 48;
NumberOfFrames = size(Images, 2);
Frames = zeros([Width, Height, 3, NumberOfFrames]);
for i=1:NumberOfFrames,
Frames(:,:,1,i) = Images{i};
Frames(:,:,2,i) = Images{i};
Frames(:,:,3,i) = Images{i};
end
Mov = immovie(Frames);
movie2avi(Mov, 'movie.avi');

About

About me goes here...

Archives

Categories