How to display text in the same line after processing?

25 ビュー (過去 30 日間)
NeuronDB
NeuronDB 2022 年 3 月 31 日
回答済み: Chunru 2022 年 3 月 31 日
When I begin some data processing, I display a message - something like "Processing xyz file", after finishing the processing, I would like to display done but have it printed in the same line as before, such that it would look something like "Processing xyz file ..... done". How can i display "done" in the same line ?
Thank you !

採用された回答

Chunru
Chunru 2022 年 3 月 31 日
Try the following (not on line)
s1 = 'Processing xyz123 file';
fprintf('%s', s1); % printing without change line
Processing xyz123 file
pause(1) % processing
% go back the beginning of the line
for i=1:length(s1)
fprintf('%c', char(8)); % backspace one char
end
fprintf('Finished. \n')
Finished.

その他の回答 (1 件)

Simon Chan
Simon Chan 2022 年 3 月 31 日
Somthing like this?
fprintf('Processing xyz file .....');
a = rand(10000,10000);
fprintf('done')

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by