How do I restrict my data that needs to be plotted?
8 views (last 30 days)
Show older comments
I have the following code:
xrayslice = 'projection0000.tif';
A = imread(xrayslice, 1);
C = A(60,:);
plot(C)
axis([200,300,0,40000])
xlabel('Pixel');
ylabel('Counts');
title('Projection of X-Ray slice');
Which produces a plot that I want, but only because the axis are restricted. How would I go about producing the same graph but by restricting my data, not my axis? I need my x values to be plotted between 200 and 300 and my y values to be plotted between 0 and 40000. I have tried using
if C<40000
plot(C)
end
but this doesn't work. Any helps or tips would be appreciated. Thank you!
0 Comments
Answers (2)
Babak
on 5 Dec 2012
C = A(60,:);
indices = C<40000;
C_in_Range = C(indices);
plot(C_in_Range)
axis([200,300,0,40000])
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots 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!