Educational materials

View   r1
CodeDrawWheel 1 - 30 Jul 2008 - Main.AaronStriegel
Line: 1 to 1
Added:
>
>
META TOPICPARENT name="IntroEngF08LC6"

MATLAB Helper Function - Price is Right Wheel Sketch

Draw 5 spaces of the wheel to the screen, the arrow, and populate the initial pricing array with all as global variables.

function drawWheel ()

global priceWheel;
global priceText;
global priceArrow;
global priceSpace;
global pricePos;

pricePos = int16(0);

% Price order (from Wiki)

    priceWheel = {'0.05','1.00','0.15', '0.80', '0.35', '0.60', '0.20', '0.40', '0.75', '0.55', '0.95', '0.50', '0.85', '0.30', '0.65', '0.10', '0.45', '0.70', '0.25', '0.90'};    

    for j=1:5                
        priceText(j) = writeText(25.5, 37.5-j*5.25, priceWheel(j));
        
        set(priceText(j),'FontName','FixedWidth')
        set(priceText(j),'FontWeight','bold');
        set(priceText(j), 'Clipping', 'off');
        set(priceText(j), 'FontSize', 24);
        
        % Rectangle
        priceSpace(j) = drawRectangle(25,35-j*5.25,5,5);
        
        set(priceSpace(j), 'FaceAlpha', 0.5);
        
    end
    
    priceArrow = drawRectangle(13.5,20,10,2);

    drawTriangle(23,24.5,23,23.5,21,18.5,'red');
    
    redraw
end

META FILEATTACHMENT attachment="drawWheel.m" attr="" comment="" date="1217446806" name="drawWheel.m" path="drawWheel.m" size="919" stream="drawWheel.m" tmpFilename="/usr/tmp/CGItemp39171" user="AaronStriegel" version="1"

Revision 1r1 - 30 Jul 2008 - 19:40:07 - AaronStriegel
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM