Matlab snippet not working, need help

Hello,

I think there is a problem with the Matlab snippet node. I just have this simple column.
When I place mOut=kIn.Y where Y is just one column of numerical values it doesn’t work.
I obviously want to do more than this, I want o use the decimate fn and build some filters however if this simple line is not working then I must have another problem.

I have attached 2 photos describing the situation.
If anyone can help me I would appreciate it since I’ve been trying to find a solution for a while now and I just can’t seem to find it.

First things first, does the script node run successfully if the script is simply mOut = kIn; ?

If that’s OK, what about mOut.colName = kIn.Y; ? (you can replace colName with whatever you want the output column to be called). The output of your script needs to be the same data type as the input.

I tried mOut.K=kIn.Y; and still have the same problem

mOut=kIn also doesn’t work.

In that case the problem is not the script, it’s something else. What versions are you using? The MATLAB script node works for me on KNIME 3.7.2, Matlab Scripting Extension 3.3.0.v201902130805 and MATLAB R2018b on Windows 10 (and before that on Windows 7), but I had problems with previous versions (of KNIME and/or the extension).

I believe I have the latest version of Knime and the Extension.

Dear @mohamad1014
looking at your screenshots, I suspect, that your table is empty (no rows). could you repeat the test using a DataGenerator node, or make sure that the XLS Reader node actually has an output table with some data?

The table does contain data, a column of 1800 rows of data type double.

ok, can you post the full error output from matlab and knime please?

Ok, I might have found the cause. Is it correct that you use the “table” type in matlab? please check in Preferences > KNIME > MATLAB scripting. Try to change the data type to “map”, this might be a workaround.

It still doesn’t work !!
I tried struct, map, dataset, table the same thing.
I even built a column X with one row and still didn’t work.
the snippet error message from matlab is ‘‘Size vector should be a row vector with real elements.’’

YES !!
Somehow it then worked, but still have one last question. Can I use the flow variables inside the Snippet ? Cause I can’t see them in the Input attributes in order to use them.
Thank you !!

Hi @mohamad1014
glad it works now.

I pushed a fix for a bug that I fixed while trying to reproduce yours. I is available from the nightly builds:
see https://www.knime.com/community
This should fix it for you also for other MATLAB data types. If you get a chance to test it and give some feedback, that would be awesome.

Flow variables work to some extent in RGG. Check out the docs under the following link.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.