help-octave
[Top][All Lists]
Advanced

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

Re: Problem with reading lists


From: Quentin Spencer
Subject: Re: Problem with reading lists
Date: Wed, 09 Mar 2005 08:37:47 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

John W. Eaton wrote:

On  8-Mar-2005, Marcus Vinicius Eiffle Duarte <address@hidden> wrote:

| I just discovered that textread returns lists, instead of cell arrays.

It should probably return cell arrays instead, since lists are
deprecated and will eventually be removed from Octave.  Would someone
like to do the conversion?

jwe


I think this patch may be all that is necessary. I've never used textread--does someone want to test it?

--- octave-forge/main/io/textread.m     2003-09-12 09:22:42.000000000 -0500
+++ textread.m  2005-03-09 08:33:16.329991968 -0600
@@ -122,7 +122,7 @@
  cat = setstr(cat);
  for i=1:length(cat)
    if cat(i) == "s"
-      eval(sprintf("a%d=list();",i));
+      eval(sprintf("a%d={};",i));
    elseif cat(i) == "c"
      eval(sprintf("a%d="";", i));
    else
@@ -167,7 +167,7 @@
                   format(idx(i):idx(i+1)-1),row,i);
       endif
        if (cat(i) == "s") # list of strings
-         eval(sprintf("a%d = append(a%d, data);", i, i));
+         eval(sprintf("a%d = {a%d{:}, data};", i, i));
       elseif (cat(i) == "c" )  # matrix of characters
          eval(sprintf("a%d = [ a%d ; data ];", i, i));
        else                       # matrix of scalars



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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