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

5 ビュー (過去 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 Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by