MATLAB Answers

matlab syntax error "for" cannot run as it appears

18 views (last 30 days)
Danil Grachev
Danil Grachev on 21 Oct 2020
Commented: Cris LaPierre on 21 Oct 2020

  0 Comments

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 21 Oct 2020
Edited: Cris LaPierre on 21 Oct 2020
The issue here is you have named your script 'for.m' but for is a reserved word indicating the start of a for loop.
Give your script a different name, type 'clear for' in the Command Window, and then try again.
Typically, you would include the N=12; in your script, and just press the green Run button to run the whole script.

  1 Comment

Cris LaPierre
Cris LaPierre on 21 Oct 2020
It looks like you are new to MATLAB. Consider going through MATLAB Onramp, which provides a brief introduction to the MATLAB environment and fundamentals.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!