As the following code shown, there will always be an error saying "Unexpected MATLAB expression" for the first "num2str" in the row defining filename. Please, help me!!!
WeChat Screenshot_20190114165317.png

 채택된 답변

Star Strider
Star Strider 2019년 1월 15일

1 개 추천

The ‘filename’ assignment in your code is not the correct syntax.
It should be:
filename = ['A',num2str(kk),'.dat'];
Note the square brackets [], and not parentheses ().
However, using the sprintf function is preferable:
filename = sprintf('A%d.dat', kk);
I would use that instead.

댓글 수: 2

Yingjie Cheng
Yingjie Cheng 2019년 1월 15일
Problem solved. Thank you so much!!
Star Strider
Star Strider 2019년 1월 15일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2019년 1월 15일

댓글:

2019년 1월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by