MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE Betriebsanweisung Seite 128

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 274
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 127
5 Controlling Code Generation
5-2
Code Generation Overview
Example M-Files
To generate the various files created by the Compiler, this chapter uses several
different M-files
gasket.m, foo.m, fun.m, and sample.m.
Sierpinski Gasket M-File
function theImage = gasket(numPoints)
%GASKET An image of a Sierpinski Gasket.
% IM = GASKET(NUMPOINTS)
%
% Example:
% x = gasket(50000);
% imagesc(x);colormap([0 0 0;1 1 1]);
% axis equal tight
% Copyright (c) 1984-98 by The MathWorks, Inc
% $Revision: 1.1 $ $Date: 1998/09/11 20:05:06 $
theImage = zeros(1000,1000);
corners = [866 1;1 500;866 1000];
startPoint = [866 1];
theRand = rand(numPoints,1);
theRand = ceil(theRand*3);
for i=1:numPoints
startPoint = floor((corners(theRand(i),:)+startPoint)/2);
theImage(startPoint(1),startPoint(2)) = 1;
end
foo M-File
function [a, b] = foo(x, y)
if nargout == 0
elseif nargout == 1
a = x;
elseif nargout == 2
a = x;
Seitenansicht 127
1 2 ... 123 124 125 126 127 128 129 130 131 132 133 ... 273 274

Kommentare zu diesen Handbüchern

Keine Kommentare