converting python list to matlab cell array
显示 更早的评论
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 个评论
Siva Priya Bollineni
2020-9-17
编辑:Siva Priya Bollineni
2020-9-17
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!