bug in char, str2mat and strvcat behaviour?
Thorsten Meyer
thorsten.meyier at gmx.de
Thu Nov 6 17:09:19 CST 2008
Hi,
with octave built from the current mercurial tip, I get:
octave:52> str2mat("a", "b", "", "c")
ans =
a
b
c
octave:53> char("a", "b", "", "c")
ans =
a
b
c
octave:54> strvcat("a", "b", "", "c")
ans =
a
b
c
So str2mat will generate an empty line for an empty string, while char and strvcat eliminate the
empty string.
However, the matlab documentation says:
[...]
S = str2mat(T1, T2, T3, ...) forms the matrix S containing the text strings T1, T2, T3, ... as rows.
The function automatically pads each string with blanks in order to form a valid matrix. Each text
parameter, Ti, can itself be a string matrix. This allows the creation of arbitrarily large string
matrices. Empty strings are significant.
Note This routine will become obsolete in a future version. Use char instead.
Remarks
str2mat differs from strvcat in that empty strings produce blank rows in the output. In strvcat,
empty strings are ignored.
[...]
So apparently, char is supposed to behave like str2mat in this respect and the above is a bug in the
char() function. Could someone with access to matlab please try, what really happens for the above
examples?
regards
Thorsten
More information about the Bug-octave
mailing list