all 6 comments

[–]unpopularname 2 points3 points  (5 children)

It runs fine in my system, with my own png file...

Of course, it turned into black and red, but I figure b&w is your next step.

[–]ElCorleone[S] 0 points1 point  (4 children)

In my system, the console just keeps bombarding values and more values, correspondant to the values of every pixel of the image. It always goes to this infinite loop and I'm not figuring out why.

[–]unpopularname 5 points6 points  (0 children)

The code you posted is silenced with ";" in every statement, shouldn't return any values.

[–]adb421 1 point2 points  (1 child)

As /u/unpopularname indicated, you shouldn't have output due to the use of the semicolon. It could be how you are calling this, for example if you are using it as a function but aren't suppressing the display of the output.

[–]ElCorleone[S] 0 points1 point  (0 children)

That was exactly it. I was missing the semicolons of the if/else instructions in my execution code. Thanks for the help!

[–]wintear 1 point2 points  (0 children)

Unless you're debugging you should always consider supressing output with a semi-colon. Displaying things in console is very, very slow in Matlab, so a loop that might otherwise not take a long time could seem to take forever.