Interface to MatLab

This interface uses buitin MatLab COM (OLE) Server

Sample APL Session

     )load r2apl
d:\r2apl saved Mon Apr 06 22:10:59 2009
      mlinit   ⍝ initialize connection to MatLab COM server
      )obs     ⍝ new object MatLab is created
MatLab
      mlput 2 3⍴⍳6 ⍝ put APL matrix to MatLab

== Do something in MatLab

» X

X =

     1     2     3
     4     5     6

» sum(X)

ans =

     5     7     9

» s=sum(X);
» 

== Back to APL ==

5 7 9

}}}

And MatLab graphics window pops up:

surf.png

Dyalog APL functions

rinit

Initialize APL connection to R COM Server.

     ∇ rinit
[1]    '#.R'⎕WC'OleClient' 'StatConnectorSrv.StatConnector'
[2]    #.R.Init('R')

rexec

Execute R expression and possibly return the result to APL

     ∇ a←{r}rexec exp
[1]    ⍝ Execute R expression and possibly return the result
[2]    ⍝R: R expression ('char')
[3]    ⍝L: if 1, then return the result
[4]    ⍎(0=⎕NC'r')/'r←0'
[5]    a←⍬
[6]    :If r
[7]        a←#.R.Evaluate(exp)
[8]    :Else
[9]        #.R.EvaluateNoReturn(exp)
[10]   :EndIf

rput

Put APL array into R

     ∇ {m}rput a;x1
[1]    ⍝ Put APL array into R
[2]    ⍝R-name of variable to export from APL
[3]    ⍝L-name of variable to create in R
[4]    ⍎(0=⎕NC'm')/'m←''x''' ⍝ Default name is x
[5]    m←,⊂m
[6]    a←,⊂a
[7]    #.R.SetSymbol(m,a) ⍝ put var a into R with name m

rget

Get R variable (matrix or vector) to APL

     ∇ r←rget name;rho;Re;Im;⎕ML
[1]   ⍝ Get R variable (matrix or vector) to APL
[2]   ⍝R-name of variable to import ('char')
[3]    ⎕ML←3
[4]    r←#.R.GetSymbol(name)