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 件のコメント

Star Strider
Star Strider 2019 年 3 月 31 日
... it just has an issue with the subplot ...
Which is ... ?
dpb
dpb 2019 年 3 月 31 日
"it just has an issue with the subplot"
And what might that be?
The crystal ball is in the shop (yet) again...
Lizzy tatarek
Lizzy tatarek 2019 年 3 月 31 日
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.

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2019 年 3 月 31 日
編集済み: Star Strider 2019 年 3 月 31 日

0 投票

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 件のコメント

Lizzy tatarek
Lizzy tatarek 2019 年 3 月 31 日
I tried that, but it still shows that error message with subplot on the end of the address?
Star Strider
Star Strider 2019 年 3 月 31 日
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 2019 年 3 月 31 日
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 2019 年 3 月 31 日
So I completely deleted the subplot file, and it worked, thank you for the help!
Star Strider
Star Strider 2019 年 3 月 31 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by