Plotting Images on a Subplot from a Loop

Hello,
I am using a loop to load and analyse images, I now want to be able to load a sample of the images and plot them on a subplot.
so far this is what I have tried, it just has an issue with the subplot, have sucesfully loaded all the images.
Any suggestions?
figure
x=0;
for K = 431:10:481
FileName=strcat('Embryo1_', sprintf('%03d',K),'.tif');
I = imread(FileName);%load image
x=x+1;
subplot(1,6,x)
imshow(I)
end

3 commentaires

Star Strider
Star Strider le 31 Mar 2019
... it just has an issue with the subplot ...
Which is ... ?
dpb
dpb le 31 Mar 2019
"it just has an issue with the subplot"
And what might that be?
The crystal ball is in the shop (yet) again...
Attempt to execute SCRIPT subplot as a function:
C:\Users\Lizzy\Documents\Year 3\EG-353 Research Project\Embryo images\Embryo images project\subplot.m
Error in notmatlab (line 19)
subplot(1,6,x)
is what is shown as an error message, I meant more that up until the subplot section everything works.

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 31 Mar 2019
Modifié(e) : Star Strider le 31 Mar 2019
Rename your ‘subplot.m’ function to something else, for example:
C:\Users\Lizzy\Documents\Year 3\EG-353 Research Project\Embryo images\Embryo images project\Lizzy_subplot.m
That should solve it.

5 commentaires

Lizzy tatarek
Lizzy tatarek le 31 Mar 2019
I tried that, but it still shows that error message with subplot on the end of the address?
Star Strider
Star Strider le 31 Mar 2019
It shouldn’t.
What exactly did you try?
Changing the name of your .m file is an operating system command. You can do it from MATLAB with the movefile (link) function, however it’s easier using operating system utilities, such as ’File Explorer’ on Windows.
Lizzy tatarek
Lizzy tatarek le 31 Mar 2019
this is what my screen shows, in the original code I showed I had renamed it 'notmatlab' and the same thing, sorry if i'm just being dense.matlab1snip.JPG
Lizzy tatarek
Lizzy tatarek le 31 Mar 2019
So I completely deleted the subplot file, and it worked, thank you for the help!
Star Strider
Star Strider le 31 Mar 2019
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by