from Web Deployment Using MATLAB by Todd Flanagan
A web-based gene analysis demonstration using MATLAB Builder for COM

getKMeanCentroids(k)
function imageData = getKMeanCentroids(k)

    global workingSet;
    global workingSetT;

    f = figure('Visible', 'off');
    
    [cidx, ctrs] = kmeans(workingSet, k,'dist','correlation','rep',5,'disp','final');

    for c = 1:k
        subplot(3,3,c);
        plot(workingSetT,ctrs(c,:)');
        axis tight
    end
    % Create the output filename
    imageData = getBitMap(f);
    
    

Contact us at files@mathworks.com