w****t 发帖数: 33 | 1 Debug the following code - explain the problems you find. Optionally, provid
e an
improved version.
#include
#include
char *gText = 0;
unsigned int gSize = 0; // the length of gText, in bytes
int append(const char* s )
{
if( s && s[0] )
{
if( (! gText) || (gSize = 0) )
{
gText = (char *)s;
gSize = strlen(s);
}
else
{
unsigned int len = gSize;
unsigned int s_len = strlen( s );
gSize += s_len;
char* temp = new char[ gSize ];
memcpy(temp, gText, len);
memcpy(temp + len, s, s_le |
|
|
t******t 发帖数: 13 | 3 Toolbar --> 'A'
or use gtext('your title') |
|
r****y 发帖数: 1437 | 4 gtext(), put it wherever you want, hehe. |
|
W*W 发帖数: 293 | 5 thanks. gtext should work. i don't think title will work. |
|
G******s 发帖数: 1530 | 6 问题是这样的. 比如用plot画了图, 里面有几条曲线, 我想在每条曲线边加注, 比
如"line a", "line b", 之类的. 在Matlab里用 gtext 轻松搞定, 可是在 Mathem
atica 里咋搞啊.
琢磨了半天, 还是不行. 那位朋友能指点一下吗?
多谢了. |
|
r****y 发帖数: 1437 | 7
Just same as line plots, xlabel( ), ylabel( )
If you do not want the contour values showing up, just wanna
legend, just
h = contour( *** )
b = clabel(h, 'manual');
and change "string" properties of b
Or even simpler,
gtext( your_legend)
click to whereever you wanna put
[c, h] = contour( ***);
get(h(i))
you will see the properties of line, then change it, e.g.
for i = 1:length(h)
set(h(i), 'L |
|