MATLAB Answers

0

Can you please send me the matlab code for motor imagery of foot and tongue ?

Asked by chueh yifen on 14 Jul 2018
Latest activity Commented on by Walter Roberson
on 27 Jul 2018

matlab example code of different motor imagery tasks (foot & tongue & right hand & left hand)

  7 Comments

No, I just want to write a code for motor imagery ,

        clear all; clc;
        sub=input('Enter a subject number:\n');
        subn=num2str(sub);
        resfile=['mi_',subn,'.txt'];
        logfile=['mi_',subn,'log.txt'];
        %config_display(1,4,[0,0,0],[1,1,1],'TimeNew',50,10);
        config_keyboard;
        config_results(resfile);
        config_log(logfile);
        start_cogent;
        preparestring('Start', 2,0,100);
        drawpict(2);
        aa=0;
        while(aa==0),
            keyout=waitkeydown(inf)
            if keyout==71,
                aa=1;
            end
        end
        preparestring('Instroduce experiment:',6,0,200);
        preparestring('First Part see the green arrow, Please roll the tongue',6,0,100);
        preparestring('Second Part see the red arrow, Please imagine roll the tongue',6,0,0);
        preparestring('Third Part see the green arrow, Please lift the foot',6,0,-100);%
        preparestring('Four Part see the red arrow, Please imagine lift the foot',6,0,-200);%
        t0=drawpict(6);
        waituntil(t0+5000)
        clearpict(6);
        preparestring('First Part see the green arrow, Please roll the tongue',7,0,0);
        t0=drawpict(7);
        waituntil(t0+4000)
        clearpict(7);
preparestring('C:\Users\User\Documents\MATLAB\motorimagery\motor imagery jpg\motor imagery_green_down.jpg',2,0,100);
load('C:/Users/queyifen/Documents/MATLAB/motorimagery/motor imagery jpg/motor imagery_green_down.jpg');
    t2=drawpict(1);
    waituntil(t2+2000);
    clearpict(2);

Now I have a problem is that I don't know how to put the image in.

Put the image in where? Do you mean like how to use imread() to read it into a variable in your program?

According to page 19 of http://apps.usd.edu/coglab/psyc770/pdf/cogmanv125.pdf you use loadpict() to read an image file into a memory buffer, and drawpict() with the number of the memory buffer to display a memory buffer. If you already have an array in memory, you use preparepict() of the memory array to move it into a memory buffer.

Do not use load() on an image file. Either use loadpict() or else use imread() and then preparepict()

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 14 Jul 2018

  6 Comments

This appears to be an example using g.tec http://www.gtec.at's product g.STIMunit .

Where can I found the motor imagery process code in matlab code example?

Sign in to comment.