See more articles about "Programming "

xsearch



 19 July 17:21   

    function achievement = xsearch3()

    % all-encompassing beheld seek architecture

    % started 12/06/2005

    % accepted 12/06/2005

    % Todd S. Horowitz

    global screenRect MainWindow

    % this bit should create the cipher windows/macos9 portable

    if strcmp(computer, PCWIN)

     warning off MATLAB:DeprecatedLogicalAPI;

    end

    % get constant ascribe (optional)

    prompt = ;

    defaults = ;

    answer = inputdlg(prompt, Beginning Bureaucracy Information, 1, defaults);

    % now break answer

     = deal(answer);

    pTrials = str2num(pTrials);

    xTrials = str2num(xTrials);

    setsizes = str2num(setsizes);

    % additional above variables

    formatString = %s, %d, %d, %d, %d, %d, %d, %d, %d
; % this is for data output

    % adored variables: subject, block, trial, target, setSize, timeoutFlag, wrongKeyFlag, err, RT

    keys = ; % acknowledgment key assignments

    dataFileName = xsearch3Data;

    jitter = 10; % coordinates of stimuli will alter by up to this abundant in their filigree cells

    if exist(dataFileName, file) white

     midGray=black;

    end

    darkGray = (midGray+black)/2;

    lightGray = (midGray+white)/2;

    red = 1;

    blue = 2;

    green = 3;

    clut = screen(MainWindow, GetClut);

    clut (red + 1, :) = ;

    clut (blue + 1, :) = ;

    clut (green + 1, :) = ;

    if dacBits 1

     blockMessage = Convenance ;

     nTrials = pTrials;

     else

     blockMessage = Beginning ;

     nTrials = xTrials;

     end

     nTrialString = num2str(nTrials);

     screen(MainWindow, FillRect, midGray);

     message = ;

     CenterText(message);

     SitnWait;

    

     % balloon routine

     for balloon = 1:nTrials

     screen(MainWindow, FillRect, backgroundColor); %start with a bare screen

     screen(stimulus, FillRect, backgroundColor); %start with a bare screen

    

     % now baddest balloon properties

     target = randi(2); % 1 = ambition present, 2 = ambition absent

     setSize = setsizes(randi(nSetSizes));

     positionIndex = randperm(nPositions); % randomize adjustment of bang placement

     selectItem = mod(randperm(setSize ) - 1, 4) + 1; % this ensures that distractor types will be broadcast evenly

    

     % put stimuli assimilate bang screen

     for i = 1:setSize

     if ambition 1

     item = t(selectItem(1));

     else

     item = d(selectItem(i));

     end

     dx = round(randi(jitter) - jitter/2);

     dy = round(randi(jitter) - jitter/2);

     itemRect = CenterRectOnPoint(objectRect, X(positionIndex(i)) + dx, Y(positionIndex(i)) + dy);

     screen(CopyWindow, item, stimulus, objectRect, itemRect);

     end

    

     % present fixation cross

     screen(CopyWindow, fixation, MainWindow, objectRect, fixationRect);

     screen(MainWindow, WaitBlanking, fixationDuration); % synch to the vertical brace for fixationDuration refreshes

     % now archetype affectation to awning in one fell swoop

     screen(CopyWindow, stimulus, MainWindow, stimulusRect, fieldRect);

    

     % now delay for a response

     initTime = GetSecs;

     response = ;

    

     while isempty(response)&(GetSecs - initTime) < maxWait

     = KbCheck;

     if keyIsDown

     response = find(keyCode);

     response = response(1);

     responseTime = KbTime;

     end

     end

    

     if isempty(response)

     timeoutFlag = 1;

     err = 1;

     feedback = Time out!;

     RT = 0;

     else

     timeoutFlag = 0;

     responseKey = find(keys target

     err = 0;

     feedback = Correct!;

     else

     err = 1;

     feedback = Wrong!;

     end

     end

    

     % save balloon data

     % agenda that you should accessible and abutting the book every time you address to it, contrarily you may lose data in crashes

     dataFile = fopen(dataFileName, a);

     fprintf(dataFile, formatString, subject, block, trial, target, setSize, timeoutFlag, wrongKeyFlag, err, RT);

     fclose(dataFile);

    

    

     screen(MainWindow, FillRect, midGray);

     CenterText();

     WaitSecs(1);

    

     end % balloon loop

    end % block loop

    % apple-pie up and go home

    screen(MainWindow, FillRect, midGray);

    CenterText(Thank you for participating);

    SitnWait;

    clear screen;

    function SitnWait()

    FlushEvents(keyDown);

    GetChar;

    function CenterText (message, xoffset, yoffset, color, window)

    % book a argument cord centered on the screen

    % syntax = CenterText (message, , , , )

    % if you wish the argument account from center, use xoffset and yoffset

    % if window is not specified, prints to MainWindow, which haveto be a all-around in the calling function

    % 2/23/2000 accepts blush option

    % 4/23/2002 can now book to offscreen windows

    global screenX

    global screenY

    global MainWindow

    switch nargin

    case 1

     xoffset=0;

     yoffset=0;

     color = ;

     window = MainWindow;

    case 2

     yoffset=0;

     color = ;

     window = MainWindow;

    case 3

     color = ;

     window = MainWindow;

    case 4

     window = MainWindow;

    end

    windowRect = screen(window, Rect);

    width = screen(window, TextWidth, message);

    screen(window, DrawText, message, ((windowRect(3)/2)-(width/2))+xoffset, (windowRect(4)/2)+yoffset, color);

    function CenterCellText(window, messages, spacing, color)

    % prints a corpuscle arrangement of argument strings centered on the screen

    % syntax = CenterCellText(window, messages, , )

    % letters is a corpuscle arrangement of curve of text

    % agreement governs the ambit amid curve of text, in pixels

    % absence agreement is 20 pixels

    % added blush advantage 1/17/2003; alone does one blush for the accomplished thing

    % anchored amount of options bug 01/24/2003

    defaultSpacing = 30;

    switch nargin

    case 0

     error(CenterCellText requires at atomic two arguments!);

    case 1

     error(CenterCellText requires at atomic two arguments!);

    case 2

     spacing = defaultSpacing;

     color = ;

    case 3

     color = ;

    end

    lines = breadth (messages);

    % acquisition the average line

    middleLine = round(lines/2);

    yOffset = spacingfor y = 1:lines

     CenterText(messages, 0, yOffset(y), color, window);

    end

    

    


 


 screen, color, window, mainwindow, response, target, trial, yoffset, midgray, centertext, message, xoffset, fillrect, stimulus, spacing, messages, setsize, jitter, timeoutflag, ptrials, xtrials, feedback, randi, setsizes, function, centercelltext, lines, ntrials, datafile, subject, positionindex, blockmessage, str2num, block, sitnwait, selectitem, objectrect, round, copywindow, , color window, screen mainwindow, window mainwindow, mainwindow fillrect, screen window, mainwindow case, screen copywindow, fillrect midgray, centertext message, yoffset color, mainwindow fillrect midgray, color window mainwindow, window mainwindow case, screen mainwindow fillrect, screen% syntax newx, yoffset color window, xoffset yoffset color, syntax newx newy, error centercelltext requires, window messages spacing, message xoffset yoffset, messages spacing color, centercelltext window messages, fillrect midgray centertext, setsize timeoutflag wrongkeyflag, target setsize timeoutflag, trial target setsize, block trial target, ntrials screen mainwindow, fillrect backgroundcolor %start, subject block trial, randi jitter jitter, round randi jitter, backgroundcolor %start with, centertext message xoffset,

Share xsearch: Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Cryptography Addendum
Cryptography is a greek chat which agency Abstruse WritingImportant Uses of Cryptography 1. Assure acquaintance of bulletin (Achieved with Encryption Algorithms) 2. Accommodate character for affidavit (Achieved with Agee Encryption Algorithms, agenda signature algorithms) 3. Verify a

X86 Accumulation X86 Architectonics
The x86 architectonics has 8 General Purpose Registers (GPR), 6 Articulation Registers, 1 Flags Annals and an Apprenticeship Pointer.The 8 GPRs are (the adjustment in which they are authentic is the aforementioned that is acclimated in a advance to assemblage operation):EAX : Accumulato

X86 Accumulation GAS Syntax
Examples in this commodity are created using the AT&T accumulation syntax acclimated in GNU AS. The capital advantage of using this syntax is its affinity with the GCC inline accumulation syntax. However, this is not the alone syntax that is acclimated to represent x86 operations. For example, N

X86 Accumulation Amphibian Point
The aboriginal x86 ancestors associates had a separate algebraic coprocessor that would handle the amphibian point arithmetic. The aboriginal coprocessor was the 8087, and all FPUs back accept been dubbed x87 chips. After variants chip the amphibian point assemblage (FPU) into the chip itself. A

X86 Accumulation High-Level Languages
The first compilers were artlessly argument translators that adapted a high level accent into accumulation language. The accumulation accent cipher was then fed into an assembler, to make the final apparatus cipher output. The GCC compiler still performs this arrangement (code is aggregate into

X86 Accumulation MASM Syntax
This page will explain x86 Programming using MASM syntax, and will aswell altercate how to use the macro capabilities of MASM. Additional assemblers, such as NASM and FASM use syntax agnate to that of MASM, and accordingly this page will altercate those assemblers as well. MASM instructions

X86 Accumulation HLA Syntax
HLA is an assembler front end created by Randall Hyde. HLA accepts accumulation accounting using a high level format, and converts the cipher into addition architecture (MASM or GAS, usually). Addition assembler (MASM or GAS) will then accumulate the instructions into apparatus code.In MASM,

X86 Accumulation x86 Assemblers
There are a amount of altered assemblers accessible for x86 architectures. This page will account some of them, and will altercate area to get the assemblers, what they are acceptable for, and area they are acclimated the most.The GNU assembler is alotof accepted as the accumulation back end

X86 Accumulation X86 Ancestors
The x86 ancestors of microprocessors is a actual ample ancestors of chips that date aback for several years. This page will allocution about the specifics of anniversary altered processor in this family. x86 microprocessors are aswell alleged IA 32 processors.;8086/8087 : the 8086 was the ab

X86 Accumulation Ascendancy Breeze
performs a bit wise AND on the two operands and sets the flags, but does not abundance a result.performs a addition amid the two operands and sets the flags, but does not abundance a result.loads EIP with the defined abode (i.e. the next apprenticeship accomplished will be the one define