From help-octave-request at bevo dot che dot wisc dot edu Tue Feb 10 12:54:02 1998 Subject: Empty matrix question From: Andy Adler To: help-octave at bevo dot che dot wisc dot edu Date: Tue, 10 Feb 1998 12:00:15 -0700 (MST) I'm having a problem with empty matrices. There's probably an octave preference variable to do this but I couldn't find it. (So far 90% of my questions to help-octave have been answered by a preference variable) Anyway, here's the sample code octave:54> vector=ones(1,5); octave:55> numfix=0; octave:56> vector(1:numfix)=zeros(numfix,1); error: A([]) = X: X must also be an empty matrix error: evaluating assignment expression near line 56, column 17 "numfix" is not necessarily zero in the "real" code, but can be zero if there are no elements to "fix" The problem seems to be that the matrices are different types of empty matrix octave:58> vector(1:numfix) ans = [](0x0) octave:59> zeros(numfix,1) ans = [](0x1) Because this works if I try octave:60> vector(1:numfix)=zeros(0,0); I realize that I could fix this code using something like octave:56> vector(1:numfix)=zeros(numfix, (numfix>=1) ); but this seems to be inelegant. Is there a way to change it? ( On a side note, The abstract of one of the articles referenced by the octave docs talks about the inadequacy of the MATLAB empty matrix realization. This must explain why Octave is implemented the way it is Does anyone feel like explaining to me what the deficiencies are? [ Nett, CN. Haddad, WM.IEEE Trans Automatic Control. 38:771-5. 1993 A system-theoretic appropriate realization of the empty matrix concept Abstract: A system-theoretic appropriate realization of the empty matrix concept is effectively utilized to transparently handle static and single vector input, single vector output systems within the more general context of dynamic, two vector input, two vector output systems. The deficiencies of the present MATLAB realization of this concept are described. ] ) _____________________________________________________________________ Andy Adler, | Pulmonary Physiology Unit | Lab 303-398-1626 adlera at njc dot org| | National Jewish Center,Denver,USA | National Jewish Center,Denver,USA | Fax 303-398-1607 Just because you're not paranoid doesn't mean they're not out to get you