How to use Num2str?

4 views (last 30 days)
Hi,
I have researched Matlab. When I use Num2str,
disp (['Iteration ' num2str (it) ': Best cost = ' num2str (Bestcosts(it))]);
it happen a mistake
Error using num2str (line 41)
Not enough input arguments.
Please, help me solve this problem
Thank you

Accepted Answer

Majid Farzaneh
Majid Farzaneh on 26 May 2018
Edited: Majid Farzaneh on 26 May 2018
Hi, Don't use space between num2str and '('. This will work:
disp (['Iteration ' num2str(it) ': Best cost = ' num2str(Bestcosts(it))]);
  5 Comments
Majid Farzaneh
Majid Farzaneh on 26 May 2018
You're welcome

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by