Can you paste complete error message? From the given image it appear that you should move the line
Y = imread('xyz.jpg');
at the start of the script.
Info
This question is closed. Reopen it to edit or answer.
Can you paste complete error message? From the given image it appear that you should move the line
Y = imread('xyz.jpg');
at the start of the script.
You should really paste your code as text (use the {}Code button for formatting), and include the entire error message. It gives information about the nature of the error. Does the variable Y exist? Does it contain an array that is a valid input so it can be written to jpeg? Is the q variable valid (i.e. is it indeed a scalar in the range 0-100)?
It would be easy to see which of these occurred if you look at the complete message.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!