Error in printing number
1 view (last 30 days)
Show older comments
I have a code below in which i have error in printing value at the third column
for m3 = 1:(length(dirlist))
I = imread([pathname, dirlist(m3).name]);
A=rgb2gray(I);
A=imresize(A,[256 256]);
J2 = imnoise(A,'salt & pepper',0.2);
Q1=cao(J2);
Q1=imresize(Q1,[256 256]);
Er3= mean2((single(A) - single(Q1)).^2);
error(m3)= mean2((single(A) - single(Q)).^2);
PS(m2) = 20 * log10 (255 / sqrt(Er3));
figure(4),subplot(4,3,m111),imshow(A),title('Original Image')
subplot(4,3,m121),imshow(J2),title('Noise Image')
subplot(4,3,m131),imshow(Q1)
sprintf('Er3 #%d', m131);
m111=m111+3;m121=m121+3;m131=m131+3;
end
I want to print value in Er3 in third column,its not printing ,please help
1 Comment
Jan
on 12 Dec 2012
Edited: Jan
on 12 Dec 2012
@kash: You are the most frequently asking users of this forum. Please, help us to improve the quality of this forum by improving the quality of the questions. Omit all unnecessary lines of code and concentrate on the essential parts. Use code formatting for the code only, not for the complete message. Please read your own question after typing it and check, if a reader has the chance to recognize what you want to explain. Accept answers, which solve your problem. On one hand this is friendly, on the other hand it shows, that readers can care about other threads instead.
Answers (1)
Jan
on 12 Dec 2012
Edited: Jan
on 12 Dec 2012
The code contain a bunch of lines, which do not concern the problem. Posting only the relevant code is more efficient.
Perhaps you mean this line:
sprintf('Er3 #%d', m131);
This creates a string, but does not store it anywhere. Therefore is is useless. Do you mean fprintf to write to the command line? But what does "in third column" mean? Do you want this string to appear as title for the subplot in the 3rd column? Then simply add a title() command and use the sprintf command as argument.
6 Comments
Walter Roberson
on 14 Dec 2012
Replace
sprintf('Er3 #%d', m131);
with
title(sprintf('Er3 #%d', m131));
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!