%updated eg_fun used to demonstrate passing variables
%copy paste this code into a file called eg_fun.m
function eg_fun(object_handle, event, handles)
    str_entered = get(handles.edit_box, 'string');
    
    if strcmp(str_entered, 'red')
        col_val = [1 0 0];
        handles.color = 'red';
    elseif strcmp(str_entered, 'green')
        col_val = [0 1 0];
        handles.color = 'green';
    elseif strcmp(str_entered, 'blue')
         col_val = [0 0 1];
         handles.color = 'yellow';
    else
        col_val = [0 0  0];
        handles.color = 'black';
    end
    set(handles.ellipse, 'facecolor', col_val);
    guidata(object_handle,handles);