Text output keeps repeating
5 ビュー (過去 30 日間)
古いコメントを表示
Hi! I'm getting a strange result -- my text overlay for my graph is repeating itself. It used to work fine and I didn't change any of that specific code, so I'm not sure why the change happened. In addition, while trying to debug, I wrote a simpler overlay and was able to see that the overlay repeats infinitely.
The code for the text overlay is below, as well as a picture of the problem.
Picture (no error):

Picture (current error):

Code:
xlabel('Distance to the right/left of the center of the laser scanner in meters.');
ylabel('Distance in front of the laser scanner in meters.');
titleFrame = sprintf('ICP, overhead view. Scan # = %d', numberOfScans);
title(titleFrame);
output = sprintf('Angle: %f degrees. \nTotal Distance: %f m. \nRight Encoder Distance: %f m. \nLeft Encoder Distance: %f m.\nAverage Velocity: %f m/s. \nAcceleration: %f m/s^2.\n', robotAngle, robotMovement, rightEncoderTotal, leftEncoderTotal, robotVel, robotAcc);
text(xText, yText, output, 'BackgroundColor',[1 1 1], 'EdgeColor', [0 0 0]);
0 件のコメント
回答 (2 件)
per isakson
2012 年 7 月 20 日
When debugging did you inspect the value of output? The code you show can hardly give multiple groups of lines. The values of robotAngle, robotMovement, etc. are they scalars?
>> sprintf( 'A: %f\nB: %f\n', [1;2], [3;4] )
ans =
A: 1.000000
B: 2.000000
A: 3.000000
B: 4.000000
0 件のコメント
Walter Roberson
2012 年 7 月 20 日
text() will produce multiple copies of the output string if it is given non-scalar positions.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Text Analytics Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!