Tips & Tricks
Follow


lazymatlab

MATLAB O/X QUIZ

lazymatlab on 23 Feb 2024
Latest activity Edit by Stephen23 on 28 Feb 2024

MATLAB O/X Quiz
Answer BEFORE Googling!
  1. An infinite loop can be made using "for".
  2. "A == A" is always true.
  3. "round(2.5)" is 3.
  4. "round(-0.5)" is 0.
Chen Lin
Chen Lin on 23 Feb 2024
This is a fun way to share and learn some quick tips!
Stephen23
Stephen23 on 23 Feb 2024
TFTF
the cyclist
the cyclist on 23 Feb 2024
I did not realize that the most obvious way to attempt #1 will give a warning:
Warning: Too many FOR loop iterations. Stopping after 9223372036854775806 iterations.
I have not figured out how to do that one, and I am leaning toward False. (It's trivial with a while loop, of course.)
Stephen23
Stephen23 on 28 Feb 2024 (Edited on 28 Feb 2024)
"It's trivial with a while loop, of course."
When somone demonstrates an infinite WHILE-loop, then I will very happily concede that an "infinite" FOR-loop is not currently possible. Because apparently an infinite WHILE-loop is "trivial", I look forward to this demonstration soon... (although I fear that I might not survive the heat death of the universe to view preliminary results).
Rik
Rik on 24 Feb 2024

I'm also leaning towards false, since even if the number of iterations is functionally infinite (and 9,223,372,036,854,775,806 is), I can only think of ways that result in a finite number of iterations.

See Also

Tags