Category: MATLAB

File Origin Tracker (for SPM)

If you’re annoyed by having to memorize the meaning and origin of all those thousands of files that you generate every day with SPM, I’ve got something for you. A file origin tracker that will record the checksums of all the Nifti files created by SPM, along with their origins […]

xdir.m – more powerful rdir.m

It offers the same syntax as rdir.m but differs in two major ways: 1) performs processing on pathnames from a list 2) supports relative paths in the wildcard expression To demonstrate what the above means in practical terms, assume that you have the following hierarchy: For some reason you already […]

parallelize_matlabbatch

This script loads selected SPM batch, tries to intelligently guess which fields are potential candidates for “parallel splits” and after interactively asking for confirmation: splits your batch into multiple .mat, .m and .sh files (placing them in the same directory as the original batch) – the latter being ready for […]

Efficient CSV Reader for MATLAB

This CSV reader will provide you with uncompromised performance. Thanks to the power of MEX compiler, for the first time in history you can load _HUGE_ CSV files into MATLAB in seconds. Enjoy! Usage: The attached archive contains compiled MEXW64 version. For other OS/architecture you need to: DOWNLOAD: swallow_csv.zip

Handling Java objects in MEX files

In case you are right now having the same doubts as author of this post, I might have some good news for you. The following snippet of code was supposed to be part of my upcoming Weka toolbox for SPM8. It copies content of a 2-D full real MATLAB array […]

mat_joy – MATLAB Interface for Joysticks

Admittedly, it already exists – http://code.google.com/p/prok-screen/ but its awkward way of doing things (exposing functions using ActiveX server) was a bit of overkill for our needs. Hence, this stripped down, pure MEX version. Enjoy. Usage: [position, buttons] = mat_joy(joystick_id), where: joystick_id – joystick identifier (0-15), position – list of joystick […]

Save SPM8 results with anatomical labels

Hi there! This little script saves cluster-level SPM results along with anatomical labels to spm_results_with_anat.txt file in the current directory. Results are appended to the file, so that you can run it repeatedly for different contrasts. It requires SPM8. Included are AAL atlas files: aal_MNI_V4.nii, aal_MNI_V4.txt and atlas to anatomical […]

Faster dot product for SVM

If you’ve ever used SVM for classification of 3D images, you’re probably a big fan of the kernel trick as it improves SVM performance significantly when working with such huge sets of features. I’m working in neuroscience at the moment and I think it’s fair to say that using SVM […]

ls_kmeans

Just in case you’re missing the Stats toolbox, a KMeans implementation for MATLAB. DOWNLOAD: ls_kmeans.zip

explore_matlab_path: Tree-based MATLAB source code browser

In my opinion MATLAB is rather lacking when it comes to modern software development. One of the things which always pissed me off is the absence of proper code hierarchy browser. Sure – there is current directory window but it displays everything, not only source code files and doesn’t provide […]