Indexing Python "ndarray" Data in Matlab Prior to Data Conversion
조회 수: 10 (최근 30일)
이전 댓글 표시
I am using R2016b (important for python to matlab functionality). I would like to index into a into a large numpy ndarray and pull the data I specifically need before I convert it to matlab data, because the conversion from python to matlab can be slow and cumbersome for large amounts of data. However, with everything I try I keep getting variations of the following error:
Array formation and parentheses-style indexing with objects of class 'py.numpy.ndarray' is not allowed. Use objects of class
'py.numpy.ndarray' only as scalars or use a cell array.
Can't post my exact code, but lets say I have:
ndarray1 1x1 ndarray
Row_IDs 16x1 double
The 'Row_IDs' are a list of rows within 'ndarray1' that I would like to pull all of the data from. How would I go about doing this? Up until now, I have been using the 'ndarray2mat' function to convert the data first and then pull what I need, but I would really prefer to trim it down to what I need first and then use the 'ndarray2mat' as what I am doing now is too computational expensive. If something isn't clear let me know and I will provide more info.
I fiddled around with variations of:
results = ndarray1(Row_IDs)
results = ndarray1(Row_IDs,:)
results = ndarray1{Row_IDs}
results = ndarray1[Row_IDs]
Simply because I am not very familiar with python data types and was desperate. Thorough searching through matlab answers and stack exchange has not helped me get to an answer, unfortunately.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 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!