disp some number with loop for

Hello!
please i need to disp this result from loop for
Y=6000000,Y=600000,Y=60000, Y=6000,Y=600,Y=60,Y=6,Y=0.6,Y=0.06,Y=0.006,Y=0.0006,
Y=0.00006,Y=0.000006,Y=0.0000006.
help me.thanks in advance

댓글 수: 1

Jan
Jan 2012년 7월 9일
Because this looks like a homework question, please post have you have tried so far and what problem occurred.

댓글을 달려면 로그인하십시오.

답변 (1개)

Kye Taylor
Kye Taylor 2012년 7월 9일

1 개 추천

If you need the number of zeros before the decimal place and after to be exactly as you indicated in the original question, try
v = (6:-1:-7);
for j = 1:length(v);
sprintf(['%.',num2str(-1*min(0,v(j))),'f'],6*10^v(j))
end

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2012년 7월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by