필터 지우기
필터 지우기

‘’fprintf‘’ cannot be used in a loop?

조회 수: 2 (최근 30일)
dcydhb dcydhb
dcydhb dcydhb 2019년 5월 15일
댓글: dcydhb dcydhb 2019년 5월 15일
i just want to use 'fprintf' to print some calculating results,can't it be exculated in the loop?
codes are as this
syms a b c d
x=a+b;
y=c+d;
for i=0:4;
fprintf('equation%d=%d;',i,x^2+y^2)
end
results are as this
Error using fprintf.
There is no function defined for the 'sym' input.
Error get_the_equation_use_fprintf (line 25).
Fprintf
('equation%d=%d;',i, x ^ 2 + y ^ 2)
thanks a lot!!!

채택된 답변

madhan ravi
madhan ravi 2019년 5월 15일
fprintf('equation%d=%s',i,char(x^2+y^2))
  댓글 수: 1
dcydhb dcydhb
dcydhb dcydhb 2019년 5월 15일
wonderful and thanks a lot!!!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by