2015年11月12日木曜日

Installing MATLAB Psychtoolbox on Windows 10

PC spec
Dell Inspiron 13 7000 (2-in-1)
Windows 10 Home 64bit
Core i3-6100U

It was the first time to use a Windows 10 PC for me. So I can't tell what causes this slow processing.... Anyway, I successfully installed Psychtoolbox onto Windows 10 PC with MATLAB 2014b after some struggles.

First I downloaded and installed MATLAB 2015a and Psychtoolbox, but MATLAB crashed when I called Screen function. Then I installed 2014b instead of 2015a, and MATLAB told me to install Gstreamer, which is a familiar comment for me. After installing Gstreamer, the screen function worked. I don't know the reason of the crash first I met.

** P.S.
Psychtoolbox 3 with MATLAB 2015a woked on Windows 10 PC.

2015年11月9日月曜日

MATLAB Connection using UDP (TCP/IP)

時間ないので,暫定版メモ。
今度修正します。
Pscyhtoolboxのpnetという関数を使用します。

UDP Port 5000に接続,タイムアウトを0.5秒,パケット送信がなくなると終了。

@MATLAB

sock = pnet('udpsocket',5000);
pnet(sock,'setreadtimeout',0.5)
dataP = 1;

try
    while dataP~=0
        dataI = pnet(sock,'read');
        disp(dataI);
        dataP = pnet(sock,'readpacket');
    end
catch
    disp('Closed_ERROR')
end

pnet(sock,'close')


おわり。

これで,UDPポートを使ってデータを取得するソフトから,MATLABにリアルタイムにデータを取り込むことができます。