public
Description: A Ruby interface to the MATLAB interpreted language
Clone URL: git://github.com/daikini/matlab-ruby.git
Added block usage to Matlab::Engine.new

git-svn-id: http://matlab-ruby.rubyforge.org/svn/trunk@14 
a4cadce9-4ec9-48b2-9120-f971c031a6cc
poogle (author)
Thu Feb 21 08:10:43 -0800 2008
commit  aa73d9e6ab6b24aa88fe9db8957ed624f0914a59
tree    d85cae694992615fac143de579c1b84a4414f3aa
parent  d779111be1973f435b959c9084c40179ac75bc75
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+== 2.0.1 / 2008-02-21
0
+
0
+* 1 minor enhancement
0
+ * Added block usage to Matlab::Engine.new
0
+
0
 == 2.0.0 / 2008-01-03
0
 
0
 * 1 bug fix
...
28
29
30
 
 
 
 
 
 
31
32
33
...
28
29
30
31
32
33
34
35
36
37
38
39
0
@@ -28,6 +28,12 @@ A Ruby interface to the MATLAB interpreted language.
0
   
0
   engine.save "/tmp/20_x_400_matrix"
0
   engine.close
0
+
0
+ # May also use block syntax for new
0
+ Matlab::Engine.new do |engine|
0
+ engine.put_variable "x", 123.456
0
+ engine.get_variable "x"
0
+ end
0
 
0
 == REQUIREMENTS:
0
 
...
13
14
15
 
 
 
 
 
 
16
17
18
...
28
29
30
 
 
 
 
 
 
 
 
31
32
33
...
13
14
15
16
17
18
19
20
21
22
23
24
...
34
35
36
37
38
39
40
41
42
43
44
45
46
47
0
@@ -13,6 +13,12 @@ module Matlab
0
   # p engine.get_variable "z"
0
   #
0
   # engine.close
0
+ #
0
+ # # May also use block syntax for new
0
+ # Matlab::Engine.new do |engine|
0
+ # engine.put_variable "x", 123.456
0
+ # engine.get_variable "x"
0
+ # end
0
   #
0
   # Values are sent to and from MATLAB by calling a method on the
0
   # engine with the variable name of interest.
0
@@ -28,6 +34,14 @@ module Matlab
0
       load_driver(options[:driver])
0
       
0
       @handle = @driver.open(command)
0
+
0
+ if block_given?
0
+ begin
0
+ yield self
0
+ ensure
0
+ close
0
+ end
0
+ end
0
     end
0
     
0
     # Sends the given string to MATLAB to be evaluated

Comments

    No one has commented yet.