⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 Delphi7编程80例(完全版)
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,ComObj, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    ListBox1: TListBox;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  matlab:OleVariant;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Matlab.Execute(Memo1.Text); //执行Matlab命令
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
matlab:=CreateOleObject('Matlab.Application'); //创建一个matlab程序
end;

procedure TForm1.ListBox1Click(Sender: TObject);
var i:Integer;
begin
Memo1.Clear;
Case ListBox1.ItemIndex Of
0:Memo1.Lines.Add('[x,y,z]=peaks;'+#13#10+
                   'meshz(x,y,z);'+#13#10+
                   'axis([-inf inf -inf inf -inf inf]);');
1:Memo1.Lines.Add('[x,y,z]=peaks;'+#13#10+
                   'waterfall(x,y,z);'+#13#10+
                   'axis([-inf inf -inf inf -inf inf]);');
2:Memo1.Lines.Add('[x,y,z]=peaks;'+#13#10+
                   'meshc(x,y,z);'+#13#10+
                   'axis([-inf inf -inf inf -inf inf]);');
3:Memo1.Lines.Add('[x,y,z]=peaks;'+#13#10+
                   'surfc(x,y,z);'+#13#10+
                   'axis([-inf inf -inf inf -inf inf]);');
4:Memo1.Lines.Add('contour3(peaks, 20);'+#13#10+
                   'axis([-inf inf -inf inf -inf inf]);');
5:Memo1.Lines.Add('contour(peaks, 20);');
End;

end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -