octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #43017] "text" command does not work with empt


From: Hartmut
Subject: [Octave-bug-tracker] [bug #43017] "text" command does not work with empty matrix to indicate empty line
Date: Tue, 29 Sep 2015 18:54:51 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

Follow-up Comment #8, bug #43017 (project octave):

Thanks for the elegant patch, Rik!

Seems that I was a couple of hours too late with my testing, this time. But I
HAVE tested your patch, and observed that it fully fixes the topic of this
bug. And I couldn't find any harmful sideeffects of this patch either. Now
it's pushed to the repository, anyways. So far so good.

But I also stumbled across the three "Fixme, is it Matlab compatible?"
comments in the test section of text.m . And I did run those three tests on
Matlab, to check for Matlab compatibility. Doing this, I observed several
incompatiblities which I will list in the remainder of this post. Maybe you,
Rik, could give me some feedback if it's worth posting a seperate bug report
about any of those.

But first the details. I run the following script both in Matlab 2013b and in
2014b:

clear, close all; 
clc
format compact

%% Multiple objects with single line
h = text ([0.1, 0.1], [0.5, 0.6], {'two objects with same cellstr'});
class (get (h(1), 'string'))
class (get (h(2), 'string'))
get (h(1), 'string')
get (h(2), 'string')

%% Multiple objects with same multi-line string which has empty cell
h = text ([0.7, 0.7, 0.7], [0.3, 0.5, 0.7], {'Line1'; []; 'Line3'}); 
class (get (h(1), 'string'))
class (get (h(2), 'string'))
get (h(1), 'string')
get (h(2), 'string')

%% Multiple objects with multiple lines
h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr1', 'cellstr2'});
class (get (h(1), 'string'))
class (get (h(2), 'string'))
get (h(1), 'string')
get (h(2), 'string')


The result in Matlab 2013b was:

ans =
char
ans =
char
ans =
two objects with same cellstr
ans =
two objects with same cellstr

ans =
char
ans =
char
ans =
Line1
ans =
   Empty string: 1-by-0

ans =
char
ans =
char
ans =
cellstr1
ans =
cellstr2


The result in Matlab 2014b was:

ans =
cell
ans =
cell
ans = 
    'two objects with same cellstr'
ans = 
    'two objects with same cellstr'

ans =
char
ans =
char
ans =
Line1
ans =
     ''

ans =
char
ans =
char
ans =
cellstr1
ans =
cellstr2


The result with Octave 4.0.0 with your latest patch (of this bug report)
applied is:

ans = cell
ans = cell
ans =
{
  [1,1] = two objects with same cellstr
}
ans =
{
  [1,1] = two objects with same cellstr
}

ans = cell
ans = cell
ans =
{
  [1,1] = Line1
  [2,1] =
  [3,1] = Line3
}
ans =
{
  [1,1] = Line1
  [2,1] =
  [3,1] = Line3
}

ans = char
ans = char
ans = cellstr1
ans = cellstr2


>From this I have drawn the following conclusions:

* The second "fixme test" ("Multiple objects with same multi-line string which
has empty cell") isn't Matlab compatible at all. I needed to add two numbers
to the code, in order to make it work: h = text ([0.7, 0.7, 0.7], [0.3, 0.5,
0.7], {'Line1'; []; 'Line3'}); This means: If you give Matlab a cell array
with three entries and only two x-y-coordinates  (as does the original test),
it will throw an error ("Each string specified must have a corresponding set
of coordinates"). Octave currently does NOT throw this error. Instead Octave
will plot each text line twice! So Octave is more tolerant, but produces
unexpected results. Shall I open a seperate bug report for this?  (A)

* The first "fixme test" produces cell results with Octave. This is the same
result as Matlab 2014b. In Matlab 2013b the result was still a char. So I
would consider this (currently) Matlab compatible -> OK.

* The second "fixme test" (corrected, as discussed above) produces cell
results with Octave. But both in Matlab 2013b and 2014b it produces character
arrays as results. So this is NOT Matlab compatible right now. Shall I open a
seperate bug report for this? (B)

* The third "fixme test" produces character array as result, in Octave as well
as in Matlab 2013b and 2014b. So this test is fully Matlab compatible right
now. This means you could remove the comment "## FIXME: is return value really
char in Matlab?" in the current source code of this Octave test.  (C)

Let me know if you think it's useful to open a new bug report for any of the
two real incompatiblities (A or B) listed above. If you like to, go ahead and
just remove the fixme comment in the third test (C).

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43017>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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