on 05-21-2015 7:44 PM
Hi all,
I want to integrate SAP HANA with Matlab to detect text from the natural image. In my case I will store images in HANA and than planning to process images using matlab commands to detect the text out of the image.
In order to solve this problem I am required to integrate HANA with matlab.
Any other suggestions are also welcome instead of Matlab.
Any suggestions?
- Dharmesh
Hi,
Yes, you can do it by integrating Matlab shared library in case you have exported it to shared lubrary (not all code from MatLab can be exported like solvers for instance).
basically you have to write an function pointer in AFL and link it with AFl library manually.
That was tested and it works, but i think it is much more easier to integrate code intro AFL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
MATLAB supports both ODBC and JDBC for which SAP HANA provides drivers.
With this you can access the SAP HANA data from within MATLAB.
That would be my first approach here.
- Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Matlab does have a C++ API that I suppose you could call from custom AFL functions (developed via AFL SDK). But even so, the actual processing would be done at the external Matlab engine and not at HANA itself.
I suppose Matlab would need to develop their own AFL functions with their IP within those functions to really leverage HANA's in-memory computing engine (similar to what SAS did).
Dharmesh, I did something similar but using Octave, not matlab.
By using RServe and R-package RcppOctave.
RServe is an external server connected to Hana which does R-processing.
In R, you can call OCtave functions via RcppOctave. You just have to put your Octave script somewhere on the RServe server (and use Linux or the RcppOctave packages does not work).
BTW, Octave is some kind of free open source variant of Matlab.
PS. the processing of the code is done on the RServe server, not on HANA itself.
i guess that this way is wrong approach, well, it could work, there is nothing serious in making call to octave or R function from AFL HANA, but this is wrong way.
AFL is mostly designed to include code within HANA and make calculations inside HANA for best performance and code design/support.
Topic starter asks about integration between HANA and Matlab and i give the best way to do it from my point of view and experience doing in in real life scenarios.
Please lets talk about topic.
There are some tips already mentioned in this thread about SAS, in case of Matlab author should have license and license issues to include code from Matlab into HANA AFL.
Talking about topic, one way to integrate code from Matlab into HANA AFL is to make shared library binding with AFL library and make function call of Matlab function, but this way is not optimal versus code integration into AFL.
Of course, you have ability to call scripts in any server outside HANA from AFL or just use HANA as data source, but who and how to estimate the total effect ?
Here's how I see it:
you talk about AFL. And you are completely right that AFL can use the full power of HANA, as the algorithms run natively and compiled on HANA itself.
However, there are many cases where AFL just is not good enough. For example custom algorithms, specific optimization method,...
And for those scenario's, there is at the moment no way of using raw HANA power. Instead you will have to leave the hana environment and use an external tool, like matlatb etc.
Now, and I'm merely guessing now because I haven't tested it yet, in the latest SPS11 of HANA, there is a possibility to use JAVA environment and even C++ (SAP internal use only). So theoretically it is possible to compile the matlab routine in a library, move that lib onto the hana server and call it from java or ...
Don't know if that is possible though. It would be a killer! Imagine: your own fancy algorithm powered by HANA...
i am talking about official supported methods, we have examples to use custom algos implemented in AFL by 3rd parties!!!. Did you know that ? In case you have really computational intensive task. You have to compare apples to apples, when you talk about Octave and other libraries, i want to ask you what is use case, why you want this and so on ?
Again, we are far from topic discussion.
- populate tables in HANA via R is certainly possible.
- calling Matlab in R? about a year ago this was not possible. But if I look at CRAN right now, there is a package called R.Matlab. Maybe this suits your needs?
Be aware that you are using HANA merely as storage.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.