1

I downloaded mlabwrap-purepy from: https://github.com/cpbotha/mlabwrap-purepy Next, I call matlab functions using the following:

%% Python init <br>
import matlabwrap <br>
mlab = matlabwrap.init() <br>
%% <br>

I can easily call all inbuilt matlab functions, but while calling custom functions I run into Type-Error. Consider the following matlab function:

%% Matlab Function %% <br>
function [x] = get_x() <br>
  x = 1; <br>
end <br>
%%% <br>

when I run, mlab.get_x() I get the following error:

TypeError: cannot concatenate 'str' and 'numpy.ndarray' objects <br>

Any clues to what might be happening?
I looked at: Run a MATLAB script from python + pass args - but it didn't resolve my issue.

However, when I run simple matlab scripts using mlab.eval with no input args it works, such as:

x = mlab.eval('get_x') <br>

I would like to be able to run like - mlab.function_name(arg1,arg2) - but I hit the error as described above. Any clues to what might fix this?

Community
  • 1
  • 1
pulkitag
  • 605
  • 6
  • 10

1 Answers1

0

Try adding some help strings to the function get_x().

i.e., in get_x.m file:

function [x] = get_x()
% GET_X return x
x = 1;
end
Sean Wang
  • 1
  • 1