Cell ConvertTypes - size inputs must be scalar????

Why does cell ConvertTypes not work for this?
K>> whos co
Name Size Bytes Class Attributes
co 1x1 112 System.Double[]
K>> c2 = cell(co, 'ConvertTypes', 'all')
Error using cell
Size inputs must be scalar.

답변 (1개)

Guillaume
Guillaume 2016년 5월 10일
편집: Guillaume 2016년 5월 10일

0 개 추천

"Why does cell ConvertTypes not work for this?"
The question is rather why do you expect it to work? Nowhere does it say in the documentation of cell that it takes optional paramater-names 'ConvertTypes', 'all' (or any optional parameter for that matter). As a result, your strings are interpreted as size arguments.
In any case, to convert a .Net array of doubles into a matlab array of double, it's simply:
c2 = double(co)

댓글 수: 3

Doctor G
Doctor G 2016년 5월 10일
This was the article that led me to believe it would work:
See the matlab 2016 (implemented in 2015b) article on convert .NET object arrays to cell arrays:
The reason I tried that was that I was getting a problem with
K>> cell(c)
Error using cell
Conversion to cell from System.Double[] is not possible.
Oh. I wonder why it does not appear in the documentation of cell (Although it's linked from there and I missed it).
Anyway, as I said, use
double(co)
to extract your array. If you then really want a cell array:
num2cell(double(co))

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2016년 5월 10일

댓글:

2016년 5월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by