Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
alekhyamandali

Junior Member
Registered:
Posts: 3
Reply with quote  #1 
Hi all

I am new to Monkey Logic and Task coding. I am trying to code a task where the conditions file is defined using the user loop method. 

I have 3 stages in the task. In each stage, a set of images are to be shown for n number of trials and a response is recorded for each. After completion of 'n' trials, the second stage begins where I need to display another setup and the number of trials is dependent on the subject response.

My questions are 

1) Do the timing file and condition file communicate in every trial?
2) Can we send the response information from the timing file to the userloop condition file to change the structure?

I would be very thankful if anyone could help me with these questions

Thank you in advance
Alekhya
0
Jaewon

Administrator
Registered:
Posts: 708
Reply with quote  #2 
1) In each trial, the userloop function is called before the timing script and they can exchange information via the TrialRecord structure. Did you read the example tasks in the 'task\userloop' directory? All information is there. And see the manual for more information about the TrialRecord structure.

ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/NIMH%20MonkeyLogic%20Manual.pdf#%5B%7B%22num%22%3A159%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C70%2C707%2C0%5D

2) Yes, you can do so through the TrialRecord structure. Just register the response type by calling the trialerror function in the timing script and then TrialRecord.TrialErrors will be updated accordingly. Or you can assign something to the TrialRecord.User and read it in the userloop.

ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/runtimefunctions.html#trialerror

-----

I hoped you would post your original questions. You seem to change your strategy, but I will answer the questions here anyway.

If you want to change blocks with the options in the menu, you need to set "# of trials to run in this block". Let's say, you want to run 3 trials for each of 4 blocks (total 12 trials). First, click on "1" in the "Blocks" panel and type "3" in the "# of trials to run in this block". Then click on "2" and type "3" in the "# of trials to run in this block". Repeat this to Block "4". (Or you can simply click the "Apply to all" button after you change the Block 1 setting.) If you want the task to pause after the 4th block, you need to set "Total # of blocks to run" to "4" as well.
block_change1.png 

If you want to change blocks with the block change function, you don't need to change the block settings as above. Just register the function to the "Block change function" menu.
block_change2.png 

I attach the test code for each case so that you can try yourself.

 
Attached Files
zip block_change_test1.zip (3.34 KB, 1 views)
zip block_change_test2.zip (5.09 KB, 0 views)

0
alekhyamandali

Junior Member
Registered:
Posts: 3
Reply with quote  #3 
Dear Jaewon

Thank you for the reply.

I had figured out my old questions. I am kind of stuck with this new logic. I shall try them out and update you

thanks again

alekhya
0
alekhyamandali

Junior Member
Registered:
Posts: 3
Reply with quote  #4 
Dear Jaewon

I have created 2 seperate scripts for my training and test phase.

When I run the test timing file, ML is somehow linking the training phase timing file to the testing phase!!

This is the testing phase timing file

clc;
% close all
% give names to the TaskObjects defined in the conditions file:
fixation = 1;
stim = 2;
target=3;
response=4;

% define time intervals (in ms):
dur_disp = 1500; % fixed duration to display the stimuli
dur_stim = 1000; % fixed duration for second stimulus (face)
max_reaction_time = 750; % fixed duraion for response
% ITI with a jitter of 500ms
max_iti = 1500;
min_iti = 1000;



% ITI with a jitter of 500ms
iti_jit_stim = 250;
max_iti_stim = 1000;
min_iti_stim = 750;



% Initialization:
num_trials = 30; % Maximum number of trials per image
num_blocks= 26; % Total number of images/blocks to be run


dur_iti = (max_iti-min_iti).*rand(1,1) + min_iti
dur_iti_stim = (max_iti_stim-min_iti_stim).*rand(1,1) + min_iti_stim



toggleobject(fixation); % Main function to present visual stimuli, TTL and others
idle(dur_iti);
rt = getkeypress(max_reaction_time);


The following error is being displayed
Error in Expec_train_runtime/toggleobject (line 212)
TaskObject.Status(ml_stim2toggle)=~TaskObject.Status(ml_stim2toggle);

Error in Expec_train_runtime (line 1440)
toggleobject([fixation,sample],'eventmarker',10);

Error in run_trial (line 112)
runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 1146)
result = run_trial(MLConfig,datafile);

Error while evaluating UIControl Callback.

I dont understand how they are getting linked?

thanks once again
Alekhya
0
Jaewon

Administrator
Registered:
Posts: 708
Reply with quote  #5 
Such a thing never happens in NIMH ML. See if you changed the timing file name in the conditions/userloop file.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.