Question cell structure, plotting and how to avoid a loop.
Ältere Kommentare anzeigen
Hello everybody,
I have a 1x13 cell structure called "Im" containing 13 matrices of 512x512 dimension with integer number ( which represent images). I want to plot all 13 matrices along with a fit I made, which basically should be like this code:
plot(fit,Pixels,Im{:}(:,256))
As I am sure you know, I get an error called Bad cell reference operation. The code works if I choose just one cell, for example plot(fit,Pixels,Im{5}(:,256)) but doesn't work as I tried above. I would wish not to use a loop as I think it could be avoided.
Thank you very much in advance
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 21 Sep. 2014
I don't know what fit and Pixels are but presumably they're lists of x and y coordinates. Then, for the next argument of plot() you don't put a whole image. You display images with a separate call to imshow(), image(), or imagesc().
% First, loop to display all 13 images.
for k = 1 : length(Im)
thisImage = Im{k}; % Extract image
subplot(3, 5, k);
imshow(thisImage);
end
% Now plot fit vs. Pixels
subplot(3, 5, 15);
plot(fit, Pixels, 'b-', 'LineWidth', 3);
grid on;
xlabel('fit', 'FontSize', 20);
ylabel('Pixels', 'FontSize', 20);
title('Pixels vs. fit', 'FontSize', 20);
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!