knime-mpicbg / knime-scripting

knime-scripting includes scripting extensions for KNIME to integrate R, Matlab, Python and Groovy scripts. These extensions include a collection of nodes to develop and deploy templates in the respective languages.
https://github.com/knime-mpicbg/knime-scripting/wiki
Other
43 stars 25 forks source link

Matlab Snippet - node - hashmaputils.m #105

Open q337916 opened 3 years ago

q337916 commented 3 years ago

Hi @knime-mpicbg @fmeyenhofer ,

I found an issue in the Matlab Snippet node. It is forwarded directly after launching matlab. Tha main function is called hashmaputils.m. 2020-08-27 18_17_19-MATLAB R2018b_KNIME_4 1 3_SNIPPET_

There is a sub-function called loadhashmap. in line 176 the code says: vector = cell(vector); --> correct matlab syntax would be: vector ={vector};

I cannot change it outside of the Matlab Snippet node. Although saving the change in Mtgalab, will always be overwritten during a new Matlab snippet session. Is there anyone who could update this node?

Thank you, Pedram

fmeyenhofer commented 3 years ago

Hi @q337916 thanks for bringing this to our attention could you paste the warning/error matlab throws?

q337916 commented 3 years ago

Hi @fmeyenhofer thank you for your fast response.


Inputdescripten: I created a table with header and only one row as input: kIn looks like that: column1 | column 2... char 1 | char2


background: vector = cell (vector) --> vector =cell(char1) --> The cell function in Matlab is used to allocate a vector/matrix cell with example cell(10); this time it looks like it try to convert only one char. To convert a char to cell you would need =>{char1} Maybe you wouldn't have this issue with a vector of several inputs. But with only one row, that is what you get. I did not tested the other way yet.


error message: Error using cell Conversion to cell from char is not possible.

Error in hashmaputils>loadhashmap (line 174) vector = cell(vector);

Error in hashmaputils (line 46) [kIn, columnNames] = loadhashmap(input.filePath, input.data);

Thank you, Pedram

fmeyenhofer commented 3 years ago

Hi @q337916

I tried to reproduce the error on my machine, but was unable to do so (Used to Table Creator node to create a table with two string columns of one row and feed it into the snippet node with the default script).

Could you use the 'Open in Matlab' node or the 'MATLAB Snippet' node with the default script to see if KNIME can transfer the data to MATLAB and back?

If neither of the above work, I would nee the exact input data to figure out why the transfer goes wrong. Should the above work, you would need to debug your script.

Also beware of with MATLAB type you decide to use (KNIME > Preferences > KNIME > Matlab Scripting).

q337916 commented 3 years ago

Hello @fmeyenhofer I noticed, that the issues I have mostly are connected to the start failure of Matlab. Therefore I asked Mathwork about the interface of KNIME and Matlab and the RMI Class error. Here is the suggestion of the Mathwork support. I also send an mail to niebelungen@gmx.de...

Judging by the error message, the Java components you are brining into MATLAB are trying to work with Java RMI; now as noted in the Javadoc:

https://docs.oracle.com/javase/8/docs/api/java/rmi/RMISecurityManager.html

Applets typically run in a container that already has a security manager, so there is generally no need for applets to set a security manager. If you have a standalone application, you might need to set a SecurityManager in order to enable class downloading.

Where it appears that the third-party component which you are working has not considered that "you might need to set a SecurityManager" part. In MATLAB's default Java environment indeed no SecurityManager will have been set. The following article on our website shows how a Java class could try dealing with this:

https://www.mathworks.com/matlabcentral/answers/102928-why-do-i-receive-an-error-when-connecting-to-a-java-rmi-registry-if-it-was-created-in-a-class-which

You, or whoever developed those Java classes which you are working with would have to add this to the Java side of things here.

I hope you can check the JAVA code... cheers