matlab

How to label each point in MatLab plot?

How to label each data point in a MatLab plot, like the following figure? MatLab code: x = ; y = x + rand(1,10); figure('color','w'); plot(x,y,'o'); a = '; b = num2str(a); c = cellstr(b); dx = 0.1; dy = 0.1; text(x+dx, y+dy, c); It also w
Xu Cui
18 sec read

SVM regression on time series, is there a lag?

It would be nice if we can predict the future. For example, give the following time series, can we predict the next point? Let’s use SVM regression, which is said to be powerful. We use the immediate past data point as the predictor. We train o
Xu Cui
1 min read

Use MatLab to move and click mouse, to press…

We have an interesting challenge in one of our projects. In our neuroimaging experiment, we need the participant to play a computer game while his brain is scanned (using a NIRS device ETG 4000 in this case). As you can imagine, we need to start the
Xu Cui
1 min read

Download “Cross Wavelet and Wavelet Coherence Toolbox”

The “Cross Wavelet and Wavelet Coherence Toolbox” download link by Grinsted et al (http://www.pol.ac.uk/home/research/waveletcoherence/) is dead. We will send you an active download link upon your request (an email with the download
Xu Cui
14 sec read

Brain surface template

Sometimes we need to work on the surface of a brain. Here I create a surface mask based on the standard avg152T1 image (MNI space) for you to download. Visualized in xjview, you can see the mask in the yellow curved lines. It’s actually a surfa
Xu Cui
21 sec read

Handy programs to visualize NIRS data (6): plotAverage

This is the 6th post of the series: Handy programs to visualize NIRS data When we do an experiment, we often repeat an event (or block) for a few times. For example, in a typical finger tapping task, we ask the participants to do a finger tapping for
Xu Cui
55 sec read

Extracting wavelet coherence values

In my previous blog (https://www.alivelearn.net/?p=1426) and in our paper titled “NIRS-based hyperscanning reveals increased interpersonal coherence in superior frontal cortex during cooperation” (full text pdf available ), we have shown
Xu Cui
24 sec read

MatLab tip: format shortg

The default format of output in MatLab is like below: v = 1.0e+003 * 9.0579 1.2699 9.1338 6.3236 0.9754 What if you want the format to be v = 9057.9 1269.9 9133.8 6323.6 975.4 The answer is simple. Run the following command in MatLab: format shortg
Xu Cui
7 sec read

ANOVA with MatLab

The statistics toolbox in MatLab provides an easy way to do 1-way and 2-way anova. Below are some examples. The functions are called anova1 and anovan. 1 way anova is to test if the mean in each group is same; and 2-way anova is to test (1) if the me
Xu Cui
1 min read