|
From: | Levente Torok |
Subject: | Re: type handling bug? |
Date: | Tue, 26 May 2009 13:02:41 +0200 |
User-agent: | KMail/1.11.2 (Linux/2.6.27-14-generic; KDE/4.2.2; i686; ; ) |
HI Soren, This behaviour may be questionable. It modifies my data hiddenly(!) for the expense of some memory saving. and I found no solution to this yet. octave:10> sum(sum(im==0)) ans = 16980 octave:11> sum(sum(z==0)) ans = 3144192 > tir, 26 05 2009 kl. 12:15 +0200, skrev Levente Torok: > [snip] > > listing the two vectors together as > > [ [1:s]' z ] > > Here 's' is a 'double' and 'z' is 'uint8'. In matlab, when you concat a > double and an uint8 you get an uint8. In Matlab 7.6 I see: > > >> class ([uint8(1), double(1)]) > > ans = > > uint8 > > So, this behaviour is compatible. My guess is that people mostly use the > integer classes to save memory, so Matlab downgrades other types to > integers when in doubt, to make sure that memory usage doesn't blow up. > > Søren > > Blogger of http://fapuma.blogspot.com |
[Prev in Thread] | Current Thread | [Next in Thread] |