Code covered by the BSD License  

Highlights from
Simple cells (visual cortex)

image thumbnail
from Simple cells (visual cortex) by Massimiliano Versace
One-dimensional stand-alone implementation of a model of a cortical simple cell

run_example(varargin)
function varargout = run_example(varargin)
% run_example M-file for run_example.fig
%      run_example, by itself, creates a new run_example or raises the existing
%      singleton*.
%
%      H = run_example returns the handle to a new run_example or the handle to
%      the existing singleton*.
%
%      run_example('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in run_example.M with the given input arguments.
%
%      run_example('Property','Value',...) creates a new run_example or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before run_example_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to run_example_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help run_example

% Last Modified by GUIDE v2.5 06-Jul-2009 13:14:22

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @run_example_OpeningFcn, ...
                   'gui_OutputFcn',  @run_example_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

function run_example_replot(handles)
m = handles.m*6;
o = round(handles.o*50);
handles.sInput = circshift([ones(1,50)*(-1*min(m,0)+1) ones(1,50)*(max(m,0)+1)],[0 o]);
handles.xcomp = simplecell(handles.sInput);

% plot input
axes(handles.axes3)
plot(handles.sInput);
axis([0 100 0 8]);
hxl1 = xlabel('Node');
hyl1 = ylabel('Input');

% plot output
axes(handles.axes4)
plot(handles.xcomp);
axis([0 100 -1 1]);
hxl2 = xlabel('Node');
hyl2 = ylabel('Output');

% --- Executes just before run_example is made visible.
function run_example_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to run_example (see VARARGIN)

% Choose default command line output for run_example
handles.output = hObject;

% make all handle properties available
set(0,'HideUndocumented','off');

handles.m = 0.5;
handles.o = 0;
run_example_replot(handles);

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes run_example wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = run_example_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


%======================================================================

%----------------------------------------------------------------------
% Create panel which contains input table, etc.
%----------------------------------------------------------------------
%
% --- Executes during object creation, after setting all properties.
function uipanel_main_CreateFcn(hObject, eventdata, handles)
% hObject    handle to uipanel_main (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


%----------------------------------------------------------------------
% Create panel which will contain plots
%----------------------------------------------------------------------
%
% --- Executes during object creation, after setting all properties.
function plot_panel_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plot_panel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
handles.plot_panel = hObject;
guidata(hObject,handles);

%----------------------------------------------------------------------
% Input value table help button
%----------------------------------------------------------------------
%
% --- Executes on button press in magnitudeHelp.
function magnitudeHelp_Callback(hObject, eventdata, handles)
% hObject    handle to magnitudeHelp (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

helpdlg(['This slider adjusts the size of the step in the input' ...
 ' pattern. Valid values are 1 to 7.'],'Luminance Step Magnitude');

% --- Executes on slider movement.
function magnitude_Callback(hObject, eventdata, handles)
% hObject    handle to magnitude (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

handles.m = get(hObject, 'Value');
run_example_replot(handles);
guidata(hObject,handles);


% --- Executes during object creation, after setting all properties.
function magnitude_CreateFcn(hObject, eventdata, handles)
% hObject    handle to magnitude (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function offset_Callback(hObject, eventdata, handles)
% hObject    handle to offset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

handles.o = get(hObject, 'Value');
run_example_replot(handles);
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function offset_CreateFcn(hObject, eventdata, handles)
% hObject    handle to offset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on button press in offsetHelp.
function offsetHelp_Callback(hObject, eventdata, handles)
% hObject    handle to offsetHelp (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

helpdlg(['This slider shifts the input pattern to the left or right.' ...
 ' The pattern wraps around at the edges of the plot.'],'Luminance Step Location');

% --- Executes during object creation, after setting all properties.
function axes3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes3


Contact us at files@mathworks.com