2011/6/3 Philippe MALLET <philippe.mal...@cemes.fr>: > I looked at zenity_list.m it didn’t work with multiple values. I was because > of the separator. I guess it was because of the backslash (maybe because I use > linux it was interpreted). So i suggest those changes: > > @@ -292,7 +292,7 @@ function [val, status] = zenity_list(col, data, varargin) > options.data = sprintf("\"%s\" ", data{:}); > > ## Set separator > - options.separator = '--separator="/\\|/\\"'; # Will use /\|/\ as > separator > + options.separator = '--separator="{|}"'; # Will use {|} as separator > > pre_cmd = sprintf("%s ", ... > options.title, ... > @@ -356,12 +356,13 @@ function [val, status] = zenity_list(col, data, > varargin) > ## When 'multiple' values are expected, always place the output in a cell > ## array, even if only one file is selected. > if (multi) > - idx = strfind(output, '/\|/\'); > + idx = strfind(output, '{|}'); > if (idx) > tmp_val = cell(length(idx)+1, 1); > - idx = [-4, idx, length(output)+1]; > + idx = [-2, idx, length(output)+1]; > for i = 1 : (length(idx)-1) > - tmp_val{i} = output( idx(i)+5 : idx(i+1)-1 ); > + i > + tmp_val{i} = output( idx(i)+3 : idx(i+1)-1 ) > endfor > ## Order of the output will have them ordered by row. Must create an > ## inversed cell array to allocate the values and transverse it at > the end > > –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
The ideia of the separator is to pick something with the lowest likelihood of appearing on the returned value. I also use linux and didn't had a problem. It's weird that it doesn't work for you. Could you please send the values that gave you the error? > But it would be easier to use the strsplit function. Using strsplit is great. I didn't knew of this function, just tried and works great. Will apply this change immediately. Thank you > There still a problem with the "numeric output" option. This is the error > message I get: > "error: element number 2 undefined in return list" > > It’s because there’s no status returned with the str2double function. I didn’t > make a patch because I don’t know what behaviour you want. > > –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– This worked fine for me. Could you please give some data example to replicate this? Thanks in advance > About the zenity_scale, it just works on my computer without any fgets… > > Maybe it’s because I use Octave 3.4.0. I saw you use the 3.2.4 version > shouldn’t you make an update ? Actually I already sorted this problem by using fscanf instead. It may be fixed on 3.4.0 (see octave bug #33330 here https://savannah.gnu.org/bugs/?33330 ). The bug was actually an hack to force compatibility with MatLab which seems to not deal very well with pipes. The idea of using scale this way is that it allows to generate a scale that can be used to select values and see the effect on real time (to choose treshold values on a image for example). And yeah, I should update my octave version. Thank you for looking into this. It's good to have someone else looking at it and commenting. Carnë ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev