matlab

MatLab set environment path

Quite often you need to call external or system commands inside MatLab. If those external commands are not in path, you need to add them. Here is how: setenv('PATH', );
Xu Cui
7 sec read

Converting DICOM files to Analyze file in batch mode

I use SPM’s dicom import function to convert DICOM files to Analyze files. But it’s quite inconvenient if I have 20 subjects. Below is a script to do this conversion automatically. You can call this function inside a loop. function dicom2
Xu Cui
23 sec read

Realtime feedback from NIRS recording

Hitachi provides a Matlab script (RealtimeOT.m) which can deliver real-time feedback from ETG-4000. This script is installed in the computer (Windows 2000) in the NIRS room. One can modify the script to deliver the real-time signal in the desired for
Xu Cui
2 min read

Using serial port to control ETG4000

To synchronize NIRS recording and your stimuli (visual, auditory, button press etc), your presentation program needs to talk to the NIRS machine. Hitachi ETG4000 allows serial communication between the NIRS machine and an external computer. You can u
Xu Cui
2 min read

Some plot functions for NIRS

1. plotTraces, plot a time series, or multiple time series on one plot, with vertical lines indicating the markers (events). Can be used for data quality check and global signal detection. 2. plotTopoMap, plot a map of activation. 3. plot2, scatter p
Xu Cui
22 sec read

Convert images to matrix

Quite often you need to convert an image (or multiple images) to a MatLab matrix for further analysis and visualization (e.g. extracting time series, multivariate pattern analysis, etc). SPM provides handy functions for this: P = spm_select; % select
Xu Cui
21 sec read

Wavelet Coherence

Wavelet transform coherence (WTC) is a method for analyzing the coherence and phase lag between two time series as a function of both time and frequency (Chang and Glover 2010). Here I played with it using the MatLab toolbox provided by Grinsted et a
Xu Cui
1 min read

MatLab surface lighting

Here are some parameters in matlab lighting. I first use patch command to plot the surface, then use camlight to shed some light on the surface.
Xu Cui
7 sec read

SVM regression with libsvm

SVM is mostly commonly used for binary classifications. But one branch of SVM, SVM regression or SVR, is able to fit a continuous function to data. This is particularly useful when the predicted variable is continuous. Here I tried some very simple c
Xu Cui
1 min read