rng shuffle;

arrayLen = randi( 9 ) + 1;
array = randi( 10 , 1 , arrayLen );
counts = arrayfun( @( x ) sum( array == x ) , array );
while( ~any( ( rem( counts , 2 ) == 1 ) & counts > 1 ) )
    arrayLen = randi( 9 ) + 1;
    array = randi( 10 , 1 , arrayLen );
    counts = arrayfun( @( x ) sum( array == x ) , array );
end
oddCounts = find( rem( counts , 2 ) == 1 & counts > 1 );
value = array( oddCounts( randi( length( oddCounts ) ) ) );
disp( 'Array' );
disp( array );
disp( 'Value' );
disp( value );
disp( 'Middle Position' );
disp( myMiddleFind( array , value ) );