From: B B on
I want the number of the line posted out before the line of ****. So I need to be able to fprintf the array number for that line? Any suggestions?

clear
clc
max_lines= input('Please enter # of lines:');
for i=1:max_lines
num(i)= input('Please enter # of stars:');
end
for j=1:max_lines
for i=1:num(j)
fprintf(': *');
end
fprintf('\n');
end
From: us on
"B B" <bridgette92(a)yahoo.com> wrote in message <hot490$brb$1(a)fred.mathworks.com>...
> I want the number of the line posted out before the line of ****. So I need to be able to fprintf the array number for that line? Any suggestions?
>
> clear
> clc
> max_lines= input('Please enter # of lines:');
> for i=1:max_lines
> num(i)= input('Please enter # of stars:');
> end
> for j=1:max_lines
> for i=1:num(j)
> fprintf(': *');
> end
> fprintf('\n');
> end

one of the solutions

% for ONE line
ln=4; % <- line #
sn=10; % <- star #
fprintf('%5d: %s\n',ln,repmat('*',1,sn));
% 4: **********

us
 | 
Pages: 1
Prev: Pulse length for GMSK in GSM
Next: help please