MATLAB The while Loop - MATLAB

What is MATLAB The while Loop?

The while loop repeatedly executes statements while condition is true.

Syntax

The syntax of a while loop in MATLAB is –

The while loop repeatedly executes program statement(s) as long as the expression remains true.

An expression is true when the result is nonempty and contains all nonzero elements (logical or real numeric). otherwise, the expression is false.

Example

Create a script document and type the following code

When you run the file, it displays the following result –

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

MATLAB Topics