From help-octave-request at bevo dot che dot wisc dot edu Thu Dec 6 05:07:57 2001 Subject: Empty list constructs From: Roberto Hernandez To: help-octave at bevo dot che dot wisc dot edu Date: Thu, 06 Dec 2001 08:07:29 -0300 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 -------------------------------------------------------------