From: William P. Y. H. <wil...@gm...> - 2005-12-14 02:01:58
|
Part of the discussion on octave-dev follows: On 12/9/05, David Bateman <Dav...@mo...> wrote: > William Poetra Yoga Hadisoeseno wrote: > > >On 12/9/05, David Bateman <Dav...@mo...> wrote: > > > > > >>Again, why? Here is matlab's output > >> > >> >> C =3D {[1], [2, 3, 4; 6 7 8]; [5; 9],[10 11 12]} > >> >> cell2mat(C) > >>??? Error using =3D=3D> cat > >>CAT arguments dimensions are not consistent. > >> > >>Error in =3D=3D> cell2mat at 92 > >> m{n} =3D cat(2,c{n,:}); > >> > >>The error message seems to indicate that matlab just lets cat generate > >>the error as well. > >> > >> > >> > > > >Well, in that case then we should just let cat do the job ;) > > > > > > > >>Matlab doesn't respect their own documentation either > >> > >> >> C =3D {[1, 2], [3, 4]; [5; 9],[6 7 8; 10 11 12]}; > >> >> cell2mat(C) > >> > >>ans =3D > >> > >> 1 2 3 4 > >> 5 6 7 8 > >> 9 10 11 12 > >> > >>This is with R14sp2.. > >> > >> > >> > > > >OK, this is consistent with the old (current) cell2mat. > > > > > > > >> >> C =3D {[1;2],ones(2,2)=3D=3D1} > >> > >>C =3D > >> > >> [2x1 double] [2x2 logical] > >> > >> >> cell2mat(C) > >>??? Error using =3D=3D> cell2mat > >>All contents of the input cell array must be of the same data type. > >> > >>However, this seems stupid to me, as logical arrays are supposed to be > >>promoted to double in normal usage... I'd prefer that the above remaine= d > >>legal.. > >> > >> > >> > > > >Yes, I also think the above should work (logical -> numeric). Also, I > >think char arrays should be allowed (using ascii). What do you think? > > > > > > > Promotion of type is implicit in the concatenation operation. If cat > allows it so should cell2mat in my opinion. Therefore just letting cat > generate the error messages for an illegal concatenation of types makes > sense to me, as it will report the two offending types in the > concatenation operation. I believe this means that cell2mat needs no > changes... > > Regards > David > > > -- > David Bateman Dav...@mo... > Motorola Labs - Paris +33 1 69 35 48 04 (Ph) > Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) > 91193 Gif-Sur-Yvette FRANCE > > The information contained in this communication has been classified as: > > [x] General Business Information > [ ] Motorola Internal Use Only > [ ] Motorola Confidential Proprietary > > It seems that no one has objections at this point, so I'm braving myself to submit this file (imported from octave-forge). The file is attached. -- William Poetra Yoga Hadisoeseno |