classdef classbug properties str = ""; endproperties methods function this = classbug (val) if (ischar (val)) this.str = this.str; else this.str = cellfun (@classbug, val, "UniformOutput", false); endif endfunction function sref = subsref (this, s) error ("no indexing!") endfunction endmethods endclassdef %!test %! s = classbug ("gnu octave"); %! s = classbug ({"gnu octave"}); %! s = classbug ("gnu octave");