cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate HANA with Matlab

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

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.

lbreddemann
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thank you Lars.

I think I have to be more specific here. I am not looking for the Matlab connectivity with HANA. I don't want to process that in Matlab or outside of HANA box. I am looking for some kind of integration using that I can call Matlab functions within HANA.

Regards,

Dharmesh

lbreddemann
Active Contributor
0 Kudos

Never heard of any integration like the one you mentioned.

henrique_pinto
Active Contributor
0 Kudos

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).

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi, Do you know if someone has tried this solution? Does it work with Matlab?

Former Member
0 Kudos

The described solution works with Octave, not with Matlab as the RcppOctave library only works with Matlab.

I haven't checked in the mean time if there are any Matlab/R libraries available.

What exactly are you looking for?

Because the latest HANA SP (11) opens up new possibilities.

0 Kudos

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.

Former Member
0 Kudos

Topic starter does not specifically asks for an AFL integration.

My proposed solution does not use AFL in any way.  HANA is merely used as a data source.

0 Kudos

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 ?

Former Member
0 Kudos

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...

0 Kudos

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.

Former Member
0 Kudos

Dear Vasily,

I think we are talking about completely different things.

I only replied to a reply on a 6 month old answer I gave, which was about Octave and R and HANA.

You are right BTW (even though there are use cases where AFL is not good enough, but that is not the question here).

Former Member
0 Kudos

I want to be able to use call Matlab scripts in R and then populate data tables in HANA. Is this possible in HANA SP(11)?

Former Member
0 Kudos

- 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?

CRAN - Package R.matlab

Be aware that you are using HANA merely as storage.