Apply a Formula to an Entire Column in Excel

June 9th, 2014

Two Ways to Apply a Formula to an Entire Column in Excel

This small trick can be handy if you have a lot of rows. The most commonly used method - dragging down - will be too time consuming in this case.

Author: Xu Cui Categories: life Tags:

Sample NIRS finger tapping data

May 24th, 2014

Description:

The subject is myself. I did a simple finger tapping task. I continuously tapped my right hand on the table for 10s, then rest for 20s. Then repeat this tapping-rest cycle for 20 times.

NIRS signals were recorded by Hitachi ETG-4000.

The data is very good: you can see the changes of HbO and HbR in the individual trials in motor cortex (channel 13 this case). See figure below:

(click to zoom)

The data is available for download (fill the form below). Here is the description:

1. This data file can be loaded in MatLab (using the load command).

2. After loading the data, there are 3 variables, hbo,hbr,marker. hbo is oxy-Hb data, hbr is deoxy-Hb data, and marker indicates the timing of the finger tapping event.

3. hbo and hbr are 7562×24 matrices. Each column is for a channel (and we totally have 24 channels), each row is for one time point. The sampling frequency is 10Hz.

4. mark is a 40×2 matrix. The first column can be ignored. The 2nd column is the timing of the onset and offset of finger tapping alternatingly.

To download the data, fill the following form and click Submit button. You will receive a download link shortly.






Author: Xu Cui Categories: nirs Tags:

Format a date the way you want in Excel

April 29th, 2014

In one column of your excel your date is formatted as “03/06/2001″. How do you format it to “2001 Mar 6″?

See:

Reference: http://office.microsoft.com/en-us/excel-help/format-a-date-the-way-you-want-HA102809474.aspx

Author: Xu Cui Categories: Uncategorized Tags:

Say No to SCA 5

February 24th, 2014

Universities should not accept students based on race.

Say No to SCA 5

Author: Xu Cui Categories: life Tags:

Find unique values in Excel

February 11th, 2014

Assume you have two columns in an Excel sheet. Column A contains some names, Column B also contains some names, some of which are duplicates from A. You want to know which ones are unique, and you want to create a column C where only unique names are listed.

The trick is to use the following line in column C:

=IF(ISERROR(MATCH(B1,A:A,0)),B1,"")

As you can see, only the unique names are shown in Column C. You can then copy the values of column C to D, and sort D, then you get all unique names.

http://www.youtube.com/watch?v=xvhI-IGiWN8

Author: Xu Cui Categories: life Tags:

Use MatLab to move and click mouse, to press keyboard

January 27th, 2014

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 computer game and brain data collection at the same time to make sure the behavior data and neuroimaging data are synchronized. What we usually do is to write some code to start ETG 4000 programmaticly inside the game program; but we can not do it this time because this computer game is developed by others and we can’t inject code into it.

What we want to achieve, simply put, is to click the “Go” button of the game at the same time when we start ETG 4000.

Fortunately there is a solution. We can write a MatLab program to simulate mouse movement and click. Below is the matlab code which will automatically move the mouse to point (640,640) and click it after 5s. If your computer game program requires keyboard input, the code below also contains a snippet for that.

import java.awt.Robot;
import java.awt.event.*;
robot = Robot;

% 5s later, move the mouse to point (640,640) where the 'go' button is,
% then click it.
pause(5);
robot.mouseMove(640, 640);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
% fill in the code to start ETG 4000 here

% 5s later, press key SHIFT and W at the same time
%pause(5);
robot.keyPress(java.awt.event.KeyEvent.VK_SHIFT)
robot.keyPress(java.awt.event.KeyEvent.VK_W)
robot.keyRelease(java.awt.event.KeyEvent.VK_W)
robot.keyRelease(java.awt.event.KeyEvent.VK_SHIFT)

As you can see in the following short screen shot, after we run the matlab program (called testmouse), 5s later the mouse moves to (640,640) and clicks, then key SHIFT+W is pressed.

Refer: http://www.mathworks.com/matlabcentral/answers/100545

Author: Xu Cui Categories: brain, matlab, nirs Tags:

NIH awards 4500 grants each month, peaks in summer

January 25th, 2014

A recent analysis on NIH grants. On average there are 4,500 grants awarded each month. July-September is the grant season. For more detail, check out “NIH awards 4500 grants each month, peaks in summer

NIH Awards 4500 Grants per MonthNIH Awards 4500 Grants per Month
Author: Xu Cui Categories: Uncategorized Tags:

How to retrieve text from a picture

December 21st, 2013

I get a picture and would like to copy the text in the picture. But since there are a lot of text, I do not want to type. So I wish there is a tool which can recognize text in a picture. Fortunately Microsoft’s OneNote makes it easy.

To do so, copy the picture into OneNote, then right click the picture, and click “Edit Alt Text”. You will see OneNote automatically recognize the text.

Author: Xu Cui Categories: Uncategorized Tags:

VMWare Player: guest OS not full screen?

October 3rd, 2013

VMWare Player is a great free tool if you want to run multiple operating systems on one computer. For example, you may have a Mac but need to run a few programs on Windows. Instead of purchasing a new Windows computer, you can simply use VMWare Player and install a Windows there.

I installed VMWare Player on my Windows 7 computer then installed Windows 8 inside VMWare Player. But for some reason the screen resolution of the guest OS is small. See below.

The solution is actually simple. Simply install VMWare tools. Click the “Player” menu, select Manage, then install VMWare Tools. You need to restart your guest OS.

Author: Xu Cui Categories: fun, life Tags:

Raspberry Pi for research labs (1)

September 30th, 2013

Raspberry Pi is a mini and incredibly cheap PC. The size is like a credit card, and the price is $35. See how small it is compared to my hand.

If you connect Pi with a TV (or monitor), a keyboard, a mouse, an internet cable, a SD card, then it becomes a full fledged PC. Pi is ideal for students to learn computer languages and other educational purposes. But many people are very creative in using Pi as a digital photo frame, a media center, a internet radio station etc. Pi’s performance is like a a 300MHz Pentium 2.

Can Pi be used in human behavior and brain imaging research labs?  Our specific goal is to see if we can integrate Pi in our Near Infrared Spectroscopy (NIRS) research. In this first part of experiment, we will see if we can get Pi running at all as a regular computer.

Joe in our lab and I rush into Fry’s to purchase some items needed to run Pi:

  1. Power adapter. Yes, Pi needs power. The adapter is actually identical to my smartphone (android) charger.
  2. SD card and reader. It is like the hard disc of a regular computer and is where data (including OS) is saved.
  3. HDMI to VGA adapter (to connect to a monitor)
  4. We already have a monitor, a USB mouse, and a USB keyboard.
1. let’s format the SD card and put OS in.
I am using a Windows computer so I follow the following instructions.
  1. Download the SD Association’s Formatting Tool from
    https://www.sdcard.org/downloads/formatter_4/eula_windows/
  2. Install and run the Formatting Tool on your machine
  3. Set “FORMAT SIZE ADJUSTMENT” option to “ON” in the “Options” menu
  4. Check that the SD card you inserted matches the one selected by the Tool
  5. Click the “Format” button
Then download NOOBS software from http://downloads.raspberrypi.org/noobs. It is a zip file, extract it and put the contents to the formatted SD card. Note, put the contents inside NOOBS_v1_3 folder to the SD card, but not the NOOBS_v1_3 folder itself.
2. Connect hardware to Pi.
Plug in the SD card to Pi, connect keyboard and mouse, HDMI to VGA adapter (then to monitor), Ethernet cable, and power adapter. As soon as you connect the power adapter, Pi will start to run. We have an option to select which OS to run, and we selected Raspbian, a version of Linux.
A close view of the hardware connected to Pi.
A far view of Pi and the keyboard/mouse, monitor etc. You can see the big juicy raspberry on the screen.
3. Surfing internet
Looks like it’s ready. Now let’s do something real - surfing internet. I opened Midori (a web browser) and can successfully go to any website I like.
Conclusions:
We successfully set up Raspberry Pi as a computer running Linux. The next step is to see if we can use it for research purpose.
Author: Xu Cui Categories: brain, linux, programming, web Tags: