[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Empty list constructs
From: |
Roberto Hernandez |
Subject: |
Empty list constructs |
Date: |
Thu, 06 Dec 2001 08:07:29 -0300 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120 |
Hey everyone,
I would like to ask for some suggestions on how to implement a very
common construct. Suppose I use a loop to create a string matrix
containing a list of file names. What I would normally do is to
initialize the matrix to an empty list and append a line in each loop.
The problem with this approach is that I get warnings (see example
attatched at the end) when appending the first line. I know I can turn
off the warning by setting "empty_list_elements_ok = 1". But the fact
that there is a warning at all implies that there is a more correct way
of doing this.
If so, I'm obviouly missing it. Any suggestions?
TIA,
Roberto
-----------------------------------
octave:27> fileList = "";
octave:28> fileList = [fileList; "foo"]
warning: empty matrix found in matrix list near line 28, column 13
warning: near line 28, column 10:
>>> fileList = [fileList; "foo"]
warning: empty matrix found in matrix list
warning: near line 28, column 10:
>>> fileList = [fileList; "foo"]
fileList = foo
-----------------------------------
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Empty list constructs,
Roberto Hernandez <=