From help-octave-request Thu May 27 14:12:23 1993 Subject: Re: sum(null matrix) becomes null matrix not zero From: John Eaton To: hasimoto at coral dot system dot nitech dot ac dot jp Cc: twang at meishan dot animal dot uiuc dot edu, help-octave Date: Thu, 27 May 93 14:12:19 EDT : If I execute : >>a=[] : >>b=sum(a) : The result becomes b=[]. : Is this specification of octave? It seems to me that any operation on an empty matrix should either give you an error, or it should return an empty matrix. You can choose which you prefer by setting the value of the built-in variable `propagate_empty_matrices' to either "true", "false", or "warn". I suppose that a case could be made for treating the summation and product functions as special cases (product should return 1?), but I think it is probably better to try to avoid doing operations on empty matrices. : I expected b became zero like MATLAB. I didn't know that Matlab returned 0. Are you sure that's not a bug in Matlab? Are there very many places where this is really useful? -- John W. Eaton | The exam demonstrates a comminuted, slightly overlapping jwe at che dot utexas dot edu| | angulated fracture of the midfifth metatarsal.