How Can I Convert a Line Array into a Cell Array?
조회 수: 7 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 6월 5일
답변: MathWorks Support Team
2017년 6월 6일
I recently upgraded to a version of MATLAB that uses HG2. In HG1, the output to 'plot' returned an array of numbers representing the graphics objects. I used 'num2cell' to convert the numeric arrays into cell arrays.
In HG2, the output is an array of Line objects:
>> h = plot(rand(4))
h =
4×1 Line array:
Line
Line
Line
Line
How can I convert this array of Lines into a cell array?
채택된 답변
MathWorks Support Team
2017년 6월 5일
Both the documentation and the 'help num2cell' command mention that the function 'num2cell' can take in any type of multidimensional array as input, and the array need not be numeric. As this includes arrays of graphics objects, the following command will convert the Line array into a cell array:
>> num2cell(h)
ans =
4×1 cell array
[1×1 Line]
[1×1 Line]
[1×1 Line]
[1×1 Line]
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!