- 积分
- 953
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-22
- 最后登录
- 1970-1-1
|
10金钱
Private Sub Command1_Click()
Dim str1 As String
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
str1 = "a=load('" & Text1.Text & "');"
End Sub
Private Sub Command2_Click()
Dim matlab As Object
Set matlab = CreateObject("Matlab.application")
Clipboard.Clear
matlab.Execute ("n(5)=0;")
matlab.Execute ("str1")
matlab.Execute ("b=a(:,10);m=length(b);")
matlab.Execute ("for i=1:1:m")
matlab.Execute ("if abs(b(i))>100")
matlab.Execute ("n(1)=n(1)+1;")
matlab.Execute ("elseif abs(b(i))>50.8 & abs(b(i))<=100")
matlab.Execute ("n(2)=n(2)+1;")
matlab.Execute ("elseif abs(b(i))>15.8 & abs(b(i))<=50.8")
matlab.Execute ("n(3)=n(3)+1;")
matlab.Execute ("elseif abs(b(i))>10.1 & abs(b(i))<=15.8")
matlab.Execute ("n(4)=n(4)+1;")
matlab.Execute ("elseif abs(b(i))>0 & abs(b(i))<=10.1")
matlab.Execute ("n(5)=n(5)+1;")
matlab.Execute ("end")
matlab.Execute ("end")
matlab.Execute ("set(gcf,'visible','off'),pie(n);legend('100KA 以上','50.8-100KA','15.8-50.8KA','10.1-15.8KA','0-10.1KA',-1);")
matlab.Execute ("set(gcf,'color','w');print(gcf,'-dmeta')")
Picture1.Picture = Clipboard.GetData()
End Sub
求朋友们指点一下,为什么出的图是错的。。
|
|