MATLAB: How to use Num2str

num2str

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

Best Answer

Hi, Don't use space between num2str and '('. This will work:
disp (['Iteration ' num2str(it) ': Best cost = ' num2str(Bestcosts(it))]);