The way MATLAB executes a code
Show older comments
Just wondering... suppose I have a code like
a = 1+2+3;
b = 1+3+5;
c = a+b;
fprintf('%2d',c)
What is MATLAB actually doing? Does it evaluate a before reading the line of code for b, or does it skip over the individual calculations until it reaches the print command which asks for a and b to be evaluated?
In other words, if the code is such that
a = 1+2+3;
b = 1+3+5;
fprintf('%2d',b)
would a get evaluated too and stored somewhere?
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!