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!