Error using cellfun: Input #3 expected to be a cell array, was char instead.

11 ビュー (過去 30 日間)
Bryan
Bryan 2016 年 12 月 16 日
編集済み: Stephen23 2016 年 12 月 16 日
Here is the line that errors out:
s = cellfun(@(x)(size(x,2)),T.pol,'UniformOuput', false);
Error using cellfun:
Input #3 expected to be a cell array, was char instead.
...but when I verify the class of T.pol...
class(T.pol)
ans =
cell
What am I missing?

回答 (2 件)

Stephen23
Stephen23 2016 年 12 月 16 日
編集済み: Stephen23 2016 年 12 月 16 日
Spelling mistake:
'UniformOuput'
should be
'UniformOutput'
Read the error message again: it clearly states the the problem is input #3, not input #2.

Star Strider
Star Strider 2016 年 12 月 16 日
Guessing here, but while ‘T’ may be a cell, the ‘pol’ field could be a string.
One possibility to troubleshoot this is:
Tpol = T.pol;
then see what class ‘Tpol’ is.

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by