Module: MatlabRuby
- Extended by:
- FFI::Library
- Defined in:
- lib/matlab_ruby.rb,
lib/matlab_ruby/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.initialize(matlab_dll_dir = ENV['MATLAB_RUBY_LIBS_PATH']) ⇒ Object
This initializes with the directory of the matlab dynamically linked libraries E.g.
- .start_engine ⇒ Object
- .stop_engine(engine_ref) ⇒ Object
Class Method Details
.initialize(matlab_dll_dir = ENV['MATLAB_RUBY_LIBS_PATH']) ⇒ Object
This initializes with the directory of the matlab dynamically linked libraries E.g. /usr/local/MATLAB/R2014a/bin/glnxa64
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/matlab_ruby.rb', line 10 def self.initialize(matlab_dll_dir = ENV['MATLAB_RUBY_LIBS_PATH']) ffi_lib "#{matlab_dll_dir}/libeng.so" attach_function :engOpen, [:string], :pointer attach_function :engClose, [:pointer], :int attach_function :engPutVariable, [:pointer, :string, :pointer ], :int attach_function :engGetVariable, [:pointer, :string], :pointer attach_function :engEvalString, [:pointer, :string ], :int ffi_lib "#{matlab_dll_dir}/libmx.so" attach_function :mxGetNumberOfFields, [:pointer], :int attach_function :mxGetScalar, [:pointer], :double attach_function :mxCreateDoubleMatrix, [:int, :int, :int], :pointer attach_function :mxDestroyArray, [:pointer], :void attach_function :mxGetClassName, [:pointer], :string ffi_lib FFI::Library::LIBC attach_function :malloc, [:size_t], :pointer attach_function :free, [:pointer], :void end |
.start_engine ⇒ Object
32 33 34 |
# File 'lib/matlab_ruby.rb', line 32 def self.start_engine engOpen "matlab -nosplash -nodisplay -nojvm" end |
.stop_engine(engine_ref) ⇒ Object
36 37 38 |
# File 'lib/matlab_ruby.rb', line 36 def self.stop_engine(engine_ref) engClose engine_ref end |