Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #1 
I knew that the ML zip file linked in the ML website was replaced a couple of months ago without any version number change (October, 2014), but only recently had a chance to test it. I think there is something wrong with this new package.

First of all, I got an error when I tried to assign digital output bits for Behavioral Codes, because a letter, "p", is missing in the variable name in Line 2913 of mlmenu.m.

Second, when I click the [Assign] button after correcting the variable name, a "Select Ports" window opened instead of a "Select Line" window. Looking into the updated values in the variables after closing the window, I think this is an error, not the change of the way to assign the digital output for Behavioral Codes.

Third, the timestamps of the files in the new package (4/29/2014) are older than those in the old Oct 2014 package (6/12/2014 or later). I am wondering if an old revision was downloaded from the repository by mistake when the package was rebuilt.
0
Wael.Asaad

Administrator
Registered:
Posts: 51
Reply with quote  #2 
We'll take a look at that and make sure the proper version is there.  Are you using the one in the Git repository, or downloaded directly from the ML website (which is what you mentioned, just want to confirm)?  
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #3 
I downloaded directly from the ML website.
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #4 
Hi all,

      I don't know if this is another error in this package version, but I cannot find the "toggleobject" function in the package available on the website...

Can someone please send me an earlier, complete version of Monkeylogic?

Thank you!
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #5 
There is a Monkey Logic GITHUB repository.
 
Here is a link to download a zip file of the head release version:

https://github.com/Dfreedmanlab/MonkeyLogic_stable/archive/master.zip
0
Wael.Asaad

Administrator
Registered:
Posts: 51
Reply with quote  #6 
Please note we are transitioning to the BitBucket repository: 

https://bitbucket.org/monkeylogic/monkeylogic-official

We should deprecate the Github one.

Thanks-

-Wael

0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #7 
I would be happy to fork this repo on bitbucket, but I do not have access to it.
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #8 
Just want to point out that no one can access https://bitbucket.org/monkeylogic/monkeylogic-official
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #9 
All versions currently being distributed have an error in assigning digital lines to Behavioral Codes. I patched the code and, if you want to do it yourself, here are the instructions.

1) Open mlmenu.m and look around Line 2913. If you find the following remark, your copy has the problem.
---------- Beginning of Remark ----------
                    % first select ports (allows user to select multiple
                    % ports)
---------- End of Remark ----------

2) Replace the code block where you found the above remark with the following code. Use black lines to find where to overwrite. The modified part is colored in red.
---------- Beginning of Block ----------
            % See if need to select lines as well as ports:
            if (strncmpi('Button', iovar, 6) && strcmpi(AdaptorInfo(boardnum).SubSystemsNames(subsysnum), 'digitalio')) || ~isempty(strmatch('TTL', iovar)) || strcmp('DigCodesStrobeBit', iovar)  || strcmp('CodesDigOut', iovar),
                if ~strcmpi(AdaptorInfo(boardnum).SubSystemsNames(subsysnum), 'digitalio'),
                    mlmessage('*** TTLs and Digital Codes must be assigned to a digital output ***');
                    return
                end
                
                if strcmp('CodesDigOut', iovar),
                    avports = AdaptorInfo(boardnum).AvailablePorts{subsysnum};
                    InputOutput.(iovar).Channel = avports(channelindx);
                    
                    nport = length(channelindx);
                    Line = cell(1,nport);
                    for m=1:nport
                        n = channelindx(m);
                        avlines = AdaptorInfo(boardnum).AvailableLines{subsysnum}{n};
                        thisport = avports(n);
                        choose_dio_line(avlines,1,thisport);
                        indx = get(findobj('tag', 'availablechannels'), 'userdata');
                        if isempty(indx), continue; end
                        Line{m} = avlines(indx);
                    end
                    if 1==nport, Line = Line{1}; end
                    InputOutput.(iovar).Line = Line;
                else
                    avlines = AdaptorInfo(boardnum).AvailableLines{subsysnum}{channelindx};
                    choose_dio_line(avlines);
                    indx = get(findobj('tag', 'availablechannels'), 'userdata');
                    if isempty(indx),
                        return
                    end
                    InputOutput.(iovar).Line = avlines(indx);
                end
                
            elseif strcmp('Reward', iovar) && strcmpi(AdaptorInfo(boardnum).SubSystemsNames(subsysnum), 'digitalio'),
---------- End of Block ----------

3) Next, find a function named choose_dio_line() in the same file (mlmenu.m). It is around Line 3221. Change one line as shown below (colored in red) and save it.
---------- Beginning of choose_dio_line ----------
function choose_dio_line(avlines, varargin)

xymouse = get(0, 'PointerLocation');
xpos = xymouse(1) - 230;
ypos = xymouse(2) - 100;
f = figure;
set(f, 'position', [xpos ypos 175 150], 'menubar', 'none', 'numbertitle', 'off', 'name', 'Select Line', 'color', [.76 .76 .8], 'tag', 'lineselectfig');
uicontrol('style', 'frame', 'position', [5 5 165 140]);
h = uicontrol('style', 'listbox', 'position', [15 15 70 120], 'string', avlines, 'userdata', avlines, 'tag', 'avlines', 'backgroundcolor', [1 1 1]);
uicontrol('style', 'pushbutton', 'position', [92 80 70 30], 'string', 'Ok', 'callback', 'set(findobj(''tag'', ''availablechannels''), ''userdata'', get(findobj(''tag'', ''avlines''), ''value'')); delete(gcf)');
uicontrol('style', 'pushbutton', 'position', [92 35 70 30], 'string', 'Cancel', 'callback', 'set(findobj(''tag'', ''availablechannels''), ''userdata'', []); delete(gcf)');
set(gcf, 'closerequestfcn', 'set(findobj(''tag'', ''availablechannels''), ''userdata'', []); delete(gcf)');
if ~isempty(varargin) && varargin{1},
    set(h, 'max', 2); %enable multi-select
    if 1 < length(varargin)
        portnum = varargin{2};
        set(f, 'name', ['Select Lines for Port ', num2str(portnum)]);
    else
    set(f, 'name', 'Select Lines');
end
end
waitfor(gcf);
---------- End of choose_dio_line ----------

4) Open initio.m and search the following lines. They are around Line 356-359.
---------- Beginning of Remark ----------
                % no need to specify the port number. Lines are coded in
                % the following manner:
                % e.g. for 3 ports with 8 lines in each port:
                % Port0->Lines 0-7, Port1->Lines 8-15, Port2->Lines 16-23
---------- End of Remark ----------

5) Replace the code block where you found the above remark with the following code. Use black lines to find where to overwrite. (The modified part is colored in red.) Then save the change.
---------- Begining of Block ----------
            DAQ.BehavioralCodes.DIO = eval(IO.CodesDigOut.Constructor);
            if ~isfield(IO.CodesDigOut, 'Line'), lineabsenterror; end
            try
                if ~iscell(IO.CodesDigOut.Line)
                    DAQ.BehavioralCodes.DataBits = addline(DAQ.BehavioralCodes.DIO, IO.CodesDigOut.Line, IO.CodesDigOut.Channel(1), 'out', 'BehaviorCodes');
                else
                    for m=1:length(IO.CodesDigOut.Channel)
                        if isempty(IO.CodesDigOut.Line{m}), continue; end

                        addline(DAQ.BehavioralCodes.DIO, IO.CodesDigOut.Line{m}, IO.CodesDigOut.Channel(m), 'out', 'BehaviorCodes');
                    end
                    DAQ.BehavioralCodes.DataBits = DAQ.BehavioralCodes.DIO.Line;
                end
            catch
                DaqError{1} = '*** Unable to assign output digital lines for Behavioral Codes ***';
---------- End of Block ----------


0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #10 
Jaewon,

I just finished merging your digitalio code patch from above into my ML revision 145. Please let me know if you find any problems with what I did.

Thanks,
-Eddie
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #11 
I just modified the code I posted above a little, to consider the case you want to skip a particular port without assigning a line. This additional modification is marked in blue.
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #12 
I've made the two modifications to my branch and committed the changes as rev. 165
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.