how to use cell ?
조회 수: 5 (최근 30일)
이전 댓글 표시
In my case
>> U
U =
1×2 cell array
[1×2 double] [1×2 double]
>> U{1}
ans =
1 2
>> U{2}
ans =
2 3
F = { } ;
How can I obtain F like that?
F = { {1 2} { 2 3} }
댓글 수: 0
답변 (1개)
Guillaume
2019년 11월 25일
If you're asking how to transform U into your desired F:
F = cellfun(@num2cell, U, 'UniformOuput', false);
would be one way of doing it.
However, making a cell array of scalar numbers (e.g. {1, 2}) is rarely a good idea. It uses a lot more memory and is more complicated to use.
댓글 수: 4
Guillaume
2019년 11월 25일
I still have no idea what you're asking since you haven't even explained what we start with and what you're trying to do.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!