필터 지우기
필터 지우기

Computed values of a function reiterates in Command window.

조회 수: 2 (최근 30일)
Sergey Dukman
Sergey Dukman 2015년 10월 9일
댓글: Star Strider 2015년 10월 9일
Hello, I have the following problem. After running this function (parameters(1:30))
function [p, v, a] = parameters(t)
for i=1:numel(t)
if t(i)>0 & t(i)<=10
p(i)=0.5.*t(i).^2;
elseif t(i)>=10 & t(i)<=20
p(i)=0.05.*t(i).^3-t(i).^2+15.*t(i)-50;
else t(i)>=20 & t(i)<=30
p(i)=0.0025.*t(i).^4-0.15.*t(i).^3+135.*t(i)-1650;
end
for j=1:numel(p)
v(j)=p(j)/t(j)
end
for n=1:numel(v)
a(n)=v(n)/t(n)
end
end
values of a and v reiterates in command window many times. I would like to get answer in command window without any reiteration of computed values. Can somebody help me with this?

채택된 답변

Star Strider
Star Strider 2015년 10월 9일
Terminate the lines with a semicolon (;) to suppress the Command Window output:
v(j)=p(j)/t(j);
a(n)=v(n)/t(n);
  댓글 수: 6
Sergey Dukman
Sergey Dukman 2015년 10월 9일
Now I got everything I wanted.
Thank you so much!!!
Sergey
Star Strider
Star Strider 2015년 10월 9일
As always, my pleasure!
Save the polar bears!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by