How to know where the >> are in the command window?
2 次查看(过去 30 天)
显示 更早的评论
I would like to know if there is a matlab command to know where the '>>' will be at the end of a function execution.
For example if I do
fprintf('AAAAAAAAAAAAAAA')
I will get on the next command line
AAAAAAAAAAAAAAA>>
The '>> ' are in the different position than the default position when I open Matlab. Is there a way to get where that position is?
Thanks
4 个评论
Stephen23
2019-12-19
There is no trivial way to do this once the strings have been printed.
The simplest approach is to keep track of this yourself, by adding a flag to your code that indicates if that particular message has been printed or not.
回答(1 个)
Adam
2019-12-19
Just use
fprintf('AAAAAAAAAAAAAAA\n')
instead and it will put the new line at the end so that the >> will be on the next line where you expect it to be.
1 个评论
ME
2019-12-19
The original posted has said in a comment above:
"I don't want to use the '\n' because I don't want to pollute my screen with the same message n times (so n lines). n can vary between 1 and 0.5million."
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!