octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #33219] logical() function does not accept (un


From: anonymous
Subject: [Octave-bug-tracker] [bug #33219] logical() function does not accept (unsigned) integer input
Date: Tue, 03 May 2011 14:19:12 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

URL:
  <http://savannah.gnu.org/bugs/?33219>

                 Summary: logical() function does not accept (unsigned)
integer input
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Tue 03 May 2011 02:19:11 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Improvement/Optimization
                  Status: None
             Assigned to: None
         Originator Name: Jochen Weber
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.4.0
        Operating System: Mac OS

    _______________________________________________________

Details:

Given that I'm writing code that reads/writes diverse file formats, some of
them contain parameter values stored as 32-bit (unsigned) integers, which yet
can only ever have values 0 (false) and 1 (true), which I then internally want
to handle as such (logical value).

Matlab accepts the following syntax, which fails in Octave:


filevalue = fread(fid, [1, 1], '*uint32');
storevalue = logical(filevalue);


A workaround is simple (but definitely seems run-time inefficient on first
glance):


filevalue = fread(fid, [1, 1], '*uint32');
storevalue = logical(double(filevalue));


or alternatively (not tested, but guessing this works also)


filevalue = fread(fid, [1, 1], 'uint32=>double');
storevalue = logical(filevalue);


Given that I use a function that interprets a text file containing the
information about the parameters to read/write from/to each file (depending on
the file format), I definitely wouldn't want to use the second construction as
my general syntax, as this would potentially require a large amount of extra
memory in case the read content is a large array of type uint8 or so.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33219>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]