A blog to help electrical engineers and students to learn electrical engineering topics. Basic Electrical Engineering, Power Systems, Electrical Machines, tec.. Now special course on MATLAB for Beginners.

Class

Class

Saturday, September 10, 2016

Introduction to MATLAB Scripts

MATLAB Script or programs are sequences of MATLAB commands saved in plain text files. When you type the name of the script file at the MATLAB prompt the commands in the script file are executed as if you had typed them in command window. Code for a script is done in an Editor window and saved as m-file. 



In case your code has errors, MATLAB will show an error message in the command window, when you try to run the program . Error message will be hyperlinked to the line in the file that caused the error.

Script variables are added to the workspace. —If you use the same variables in another script, they will be modified by that script. —This may result in a confusing mix of variables in the MATLAB workspace. —Some times it may lead to a syntax error or may lead to subtle errors in the result.
submit to reddit