I have a python function, Foo, which returns a tuple of 3 lists. Each list contains points I would like to manipulate and plot in matlab. Current I can retrieve my data with
data = py.Foo.main(args)
Plotting the output proved difficult. Matlab sees "data" as a python object. I was previously in a rush and my quick work around was
function [r] = convertToVector(c)
%make sure everything is numeric so I can plot it
r = [];
for i = 1:length(c)
if isnumeric(c{i})
r = [r c{i}];
end
end
filler = data.cell()
a = convertToVector(filler{1}.cell())
b = convertToVector(filler{1}.cell())
c = convertToVector(filler{1}.cell())
This works okay but for c I have something like
filler.cell{3}.cell = [0] [-1] [-1] [-1] [0.22] [0.13] [0.08]
When I run convertToVector everything is either 0 or -1. I have no idea what is going on. If I play around in the console I can get something like
r = [];
z = filler.cell{3}.cell;
r = [r z{1}] >>> r = 0
r = [r z{2}] >>> r = 0 -1
r = [r z{5}] >>> r = 0 -1 0
Why is this happening? If I replace z{1} z{2} z{5} with 0 -1 0.22 respectively, I get the results I would expect: r = 0 -1 0.22. I don't use matlab regularly and I have no idea what may cause this. I was trying to plug the results of an analysis done in python into a pre-existing matlab gui, otherwise I would avoid interfacing the two as such.
Edit: Under further inspection utilizing whos r the class is int64 when adding z{1} to z{4} first and double when adding z{5} first. The class then changes from double to int64 if I add z{1} to z{4}