简体   繁体   中英

Basic bag on the return value of a function on matlab

Consider the matlab function that describe in the image.

enter image description here

As I run this function, I get that y = 1 insted of y = 7 as expected.

Why is this happening?

any response will be appreciated.

Thanks!

Because the while gets false from the first iteration and stop.

use while (a>=v(j)) to resolve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM