MATLAB: Error using cellfun!

cellfun

hello! I am having troubles with cellfun as I have defined a new class of my data which is not supported by cellfun , I get the following error. Any suggestions to overcome this ? Thank you!
Error using cellfun
newClass output type is not supported. Set 'UniformOutput' to false.
note that I am using 'UniformOutput' as false.

Best Answer

cellfun is meant to apply a function to cells, NOT some arbitrary class that you created ("newClass"). A cell or cell array (an array of cells) is a specific type of variable in MATLAB. You can also make your own variables with custom properties and methods, called "classes", but a class is not a cell so cellfun won't work with your custom class variable. Use a normal cell array, not a custom-built class, if you want to use cellfun().