Why can't I instanciate, create, construct class objects via cellfun?

This is an example class file:
classdef tmp < handle
properties
str
end
methods
function self = tmp(str)
self.str = str;
end
end
end
Then
cellfun(@tmp,{'a','b'})
produces the error:
Error using cellfun
tmp output type is not currently implemented.

 採用された回答

Walter Roberson
Walter Roberson 2014 年 4 月 8 日

0 投票

Use 'uniform', 0 for cellfun. If you need to convert to a matrix afterwards you can cell2mat()

1 件のコメント

Roland
Roland 2014 年 4 月 9 日
OK this works:
cellfun(@tmp,{'a','b'},'uniform',0)
Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeClass Introspection and Metadata についてさらに検索

質問済み:

2014 年 4 月 8 日

コメント済み:

2014 年 4 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by