# HG changeset patch # User Rik # Date 1372282155 25200 # Node ID 563f8f0a7e29e24e4c026a6f9f0de8c8e854dfb9 # Parent d02fdab3651bf1c11b550498eca74f5dc96a0b32 Handle ticklabel specification with '|' the same way as Matlab (bug #39344). * libinterp/interpfcn/graphics.cc(convert_ticklabel_string): Append a null string if the last character of specification is the delimiter '|'. Use SPACE in charMatrix constructor rather than searching and modifying generated Matrix. diff -r d02fdab3651b -r 563f8f0a7e29 libinterp/interpfcn/graphics.cc --- a/libinterp/interpfcn/graphics.cc Wed Jun 26 22:54:44 2013 +0200 +++ b/libinterp/interpfcn/graphics.cc Wed Jun 26 14:29:15 2013 -0700 @@ -5756,7 +5756,7 @@ } else { - string_vector str; + string_vector sv; if (val.is_numeric_type ()) { NDArray data = val.array_value (); @@ -5766,30 +5766,29 @@ { oss.str (""); oss << data(i); - str.append (oss.str ()); + sv.append (oss.str ()); } } else if (val.is_string () && val.rows () == 1) { - std::istringstream iss (val.string_value ()); + std::string valstr = val.string_value (); + std::istringstream iss (valstr); std::string tmpstr; // Split string with delimiter '|' while (std::getline (iss, tmpstr, '|')) - { - str.append (tmpstr); - } + sv.append (tmpstr); + + // If string ends with '|' Matlab appends a null string + if (*valstr.rbegin () == '|') + sv.append (std::string ("")); } else return retval; - charMatrix ch (str); - - for (octave_idx_type i = 0; i < ch.numel (); i++) - if (ch(i) == 0) - ch(i) = ' '; - - retval = octave_value (ch); + charMatrix chmat (sv, ' '); + + retval = octave_value (chmat); } return retval;