converting python list to matlab cell array
Show older comments
hello, I need to retrive information from a python list using matlab.
sadly whenever I use the command
cell(c)
it retures the following error:
Error using py.list/cell
'info' is already defined as a property.
the list claims to be 1x1, and when printed on screen lookes like that:
Python list with no properties.
[<MaskedColumn name='dist' dtype='float64' length=4>
6.900571198842252e-06
0.0063900764622307465
0.009703391460735504
0.011231689015334837]
I've been able to convert it to a char type and detect numbres using the following commands
c_char = c.char;
c_cell = regexp(c_char,'\d+(\.)?(\d+)?','match');
c_arr = str2double(c_cell(3:end)');
but it has trouble with the "6.900571198842252e-06" value wich it writes as two values "6.900571198842252" and "6"
is there a good way to convert the list to a matlab variable and fix the error? or at least to extract the scientific number as one variable.
1 Comment
Siva Priya Bollineni
on 17 Sep 2020
Edited: Siva Priya Bollineni
on 17 Sep 2020
I am running same matlab file in both matlab and python. The output in matlab is a cell array whereas in python I got list. Is there any possibility to get the same output as that occurred in running matlab or can extract the data from that python list?
Pls help me with this, Thanks in advance.
Answers (0)
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!