Join/Login

Business Software

Open Source Software

For Vendors

Blog

About

More

Articles

Create

SourceForge Podcast

Site Documentation

Subscribe to our Newsletter

Support Request

For Vendors Help Create Join Login

Business Software

Open Source Software

SourceForge Podcast

Resources

Articles

Case Studies

Blog

Menu

Help

Create

Join

Login

Home

Browse

Iris

Calliope

Iris Calliope

2-photon scanning software

Brought to you by: heinmatt, kellgeor

Summary

Reviews

Support

Wiki

Tickets ▾

Bugs

Tasks

Feature Requests

SVN ▾

Iris Main

Auxiliary Code

Calliope

Discussion

Menu ▾ ▴

Browse Commits

Browse Files

[r1192]: / Library / textprogressbar.m  Maximize  Restore  History

Download this file

62 lines (53 with data), 2.2 kB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

function textprogressbar(c)

% This function creates a text progress bar. It should be called with a

% STRING argument to initialize and terminate. Otherwise the number correspoding

% to progress in % should be supplied.

% INPUTS: C Either: Text string to initialize or terminate

% Percentage number to show progress

% OUTPUTS: N/A

% Example: Please refer to demo_textprogressbar.m

% Author: Paul Proteus (e-mail: proteus.paul (at) yahoo (dot) com)

% Version: 1.0

% Changes tracker: 29.06.2010 - First version

% Inspired by: http://blogs.mathworks.com/loren/2007/08/01/monitoring-progress-of-a-calculation/

%% Initialization

persistent strCR; % Carriage return pesistent variable

% Vizualization parameters

strPercentageLength = 10; % Length of percentage string (must be >5)

strDotsMaximum = 10; % The total number of dots in a progress bar

%% Main

if strcmp(c,'inittextprogressbar')

strCR = [];

elseif isempty(strCR) && ~ischar(c),

% Progress bar must be initialized with a string

warning('The text progress must be initialized with a string');

elseif isempty(strCR) && ischar(c),

% Progress bar - initialization

fprintf('%s',c);

strCR = -1;

elseif ~isempty(strCR) && ischar(c),

% Progress bar - termination

strCR = [];

fprintf([c '\n']);

elseif isnumeric(c)

% Progress bar - normal progress

c = floor(c);

percentageOut = [num2str(c) '%%'];

percentageOut = [percentageOut repmat(' ',1,strPercentageLength-length(percentageOut)-1)];

nDots = floor(c/100*strDotsMaximum);

dotOut = ['[' repmat('.',1,nDots) repmat(' ',1,strDotsMaximum-nDots) ']'];

strOut = [percentageOut dotOut];

% Print it on the screen

if strCR == -1,

% Don't do carriage return during first run

fprintf(strOut);

else

% Do it during all the other runs

fprintf([strCR strOut]);

end

% Update carriage return

strCR = repmat('\b',1,length(strOut)-1);

else

% Any other unexpected input

error('Unsupported argument type');

end

SourceForge

Create a Project

Open Source Software

Business Software

Top Downloaded Projects

Company

About

Team

SourceForge Headquarters
225 Broadway Suite 1600
San Diego, CA 92101
+1 (858) 422-6466

Resources

Support

Site Documentation

Site Status

SourceForge Reviews

© 2025 Slashdot Media. All Rights Reserved.

Terms Privacy Opt Out Advertise

×
Want the latest updates on software, tech news, and AI?

Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.

Submit