朋友,您应该参考DELPHI7中的variants类,然后在要使用的单元中加入activex,variants,comobj三个单元,再试试,呵呵!
var
V : Variant;
MReal : OleVariant;
MImage : OleVariant;
begin
i,j : integer;
MReal := VarArrayCreate([0, 1, 0, 3], varDouble);
MImage := VarArrayCreate([0,0,0,0], varDouble);
V := CreateOLEObject('Matlab.Application');
V.Execute('a=[1 2 3 4; 5 6 7 8]');
V.GetFullMatrix('a','base',VarArrayRef(MReal),VararrayRef(MImage));
for i := 0 to 1 do
for j := 0 to 3 do
Stringgrid1.Cells[j,i] := MReal[i,j];
V.Execute('peaks');
MReal := VarArrayCreate([0, 1, 0, 3], varDouble);
MImage := VarArrayCreate([0,0,0,0], varDouble);
for i := 0 to 1 do
for j := 0 to 3 do
MReal[i,j] := i+4;
V.PutFullmatrix('b','base',VarArrayRef(MReal),VararrayRef(MImage));
end