From: Andy on 14 Jul 2010 18:57 Hi, I am having some issues with memory and it was suggested to me that I try converting the contents of my matrices from double to float. I've tried other memory management techniques and most don't work for my situation. Is it possible to convert the contents of an entire matrix into float? I tried using the float command but am getting the following error: ??? Input argument "ExpBits" is undefined. Error in ==> float at 49 DataType= struct('Class', 'FLOAT', 'MantBits', (TotalBits-ExpBits-1), 'ExpBits', Expbits); Thank you!
From: Michael on 14 Jul 2010 19:20 M_double = double(magic(10)./10); whos('M_double'); M_single=single(M_double); whos('M_single');
From: Jan Simon on 15 Jul 2010 03:48 Dear Andy, as Michael has mentioned already: "Floats" are called "single" in Matlab. See "help float". Jan
From: us on 15 Jul 2010 04:20 "Andy " <dcg48(a)cornell.edu> wrote in message <i1lfc8$co5$1(a)fred.mathworks.com>... > Hi, > I am having some issues with memory and it was suggested to me that I try converting the contents of my matrices from double to float. I've tried other memory management techniques and most don't work for my situation. > > Is it possible to convert the contents of an entire matrix into float? I tried using the float command but am getting the following error: > > ??? Input argument "ExpBits" is undefined. > > Error in ==> float at 49 > DataType= > struct('Class', 'FLOAT', 'MantBits', (TotalBits-ExpBits-1), 'ExpBits', Expbits); > > Thank you! well... according to the error message, you simply forgot the second input arg... r=float(pi,64) %{ % r = Class: 'FLOAT' MantBits: -61.858 ExpBits: 64 %} us
From: Steve Amphlett on 15 Jul 2010 05:30 "Andy " <dcg48(a)cornell.edu> wrote in message <i1lfc8$co5$1(a)fred.mathworks.com>... > Hi, > I am having some issues with memory and it was suggested to me that I try converting the contents of my matrices from double to float. I've tried other memory management techniques and most don't work for my situation. > > Is it possible to convert the contents of an entire matrix into float? I tried using the float command but am getting the following error: > > ??? Input argument "ExpBits" is undefined. > > Error in ==> float at 49 > DataType= > struct('Class', 'FLOAT', 'MantBits', (TotalBits-ExpBits-1), 'ExpBits', Expbits); > > Thank you! There is confusion in the naming of floating types here. The smallest floating type (a.k.a. single precision) is "float" in C, "REAL" in FORTRAN and "single" in Matlab. Matlab's default type: "double" is "double" in C, "DOUBLE PRECISION" in FORTRAN. To confuse things further, Matlab provides a "float" function, which does not (as might be expected by an experienced C programmer) cast an arbitrary floating type to a single precision float.
|
Pages: 1 Prev: Capturing Command Window errors from a GUI using "diary" Next: Loop with changing Variable |