How can i subplot list of image in right side GUI? with looping method
Show older comments
im working on color based image retireval..i have a variabel called fileNm containing list pathname of images.

i have successfull to plot them and sorting them for most similiar images to unsimiliar images but in new window called figure 1

i want to display them in right side of GUI like this and sorting them with the most similiar image to unsimiliar images..

this is my currently code.. but i subplot this with no sorting from most similiar image to unsimiliar images at all and i do manual code .. not in looping code..please someone help me..
% Retrieval
k=1;
ThCM=70; %threshold perbandingan citra
for j=1:ukuranbaris
Sum = sum(abs(num(j,:)-databin));
if Sum < ThCM
Dist(k)= Sum;
k=k+1;
fileNm(k) = {raw{j+1,28}};
end
end
Sum
Dist
% fileNm{1}
% fileNm{2}
% fileNm{3}
% fileNm{4}
%sorting for most similiar images to unsimiliar images
[ImShr,Inx] = sort(Dist,'ascend');
pnf = size(Dist')
%program untuk menampilkan citra secara looping pada figure baru
% for k = 2 : pnf
% thisFileName = fileNm{k};
% ImgFile2 = imread(thisFileName);
% %display the image
% axes(handles.axes2) %the current axes should be set to axes1
% imagesc(ImgFile2); %displays the data in array C as an image that uses the full range of colors in the colormap
% %clear axes scale
% subplot(3,3,k),imshow(ImgFile2);
% hold on;
% axis off
% caption = sprintf('File %d of %d : "%s"', k, numel(fileNm), thisFileName)
% title(caption, 'FontSize', 5);
% drawnow;
%
% end
ImShr
Inx
% BIKIN WINDOW BARU
for k = 1 : pnf(1,1)
thisFileName = fileNm{Inx(k)+1};
% figure(1), subplot(3,4,k),imshow(thisFileName);
subplot(3, 4, 2);
imshow(fileNm{2}); %gambar ke 2
subplot(3, 4, 3);
imshow(fileNm{3}); %gambar ke 3
subplot(3, 4, 4);
imshow(fileNm{4}); %gambar ke 4
subplot(3, 4, 6);
imshow(fileNm{5}); %gambar ke 5
subplot(3, 4, 7);
imshow(fileNm{6}); %gambar ke 6
subplot(3, 4, 8);
imshow(fileNm{7}); %gambar ke 7
subplot(3, 4, 10);
imshow(fileNm{8}); %gambar ke 8
subplot(3, 4, 11);
imshow(fileNm{9}); %gambar ke 9
subplot(3, 4, 12);
imshow(fileNm{10}); %gambar ke 10
% caption = sprintf('File %d of %d : "%s"', k, numel(fileNm), thisFileName);
% title(caption, 'FontSize', 5);
%hold on
drawnow;
end
pause(15)
close all;
13 Comments
Mochammad Fariz
on 24 Feb 2020
Adam
on 24 Feb 2020
Create a panel in your GUI to act as a parent, then you can use this to parent your subplots, as e.g.
hFig = figure;
p = uipanel( hFig );
hAxes(k) = subplot( 3, 4, 2, 'Parent', p );
Obviously you need to position the panel where you want it and can get rid of the border and whatever else you want to do, but that should work to group the plots where you want them.
Also I don't know what version of Matlab you are using, but if it is R2019b then
doc tiledLayout
gives more customisation options than subplot also.
Mochammad Fariz
on 24 Feb 2020
Edited: Mochammad Fariz
on 24 Feb 2020
Mochammad Fariz
on 24 Feb 2020
Mochammad Fariz
on 24 Feb 2020
Adam
on 24 Feb 2020
My code was just an example. Obviously in your case you have your panel in your GUI already so you use that panel where I use 'p' and don't create a new figure. I just did that to show an example of a panel in a figure.
Mochammad Fariz
on 24 Feb 2020
Adam
on 25 Feb 2020
You already have code creating all your subplots. Just parent them all to that panel.
Mochammad Fariz
on 25 Feb 2020
Adam
on 25 Feb 2020
You showed above that you added a panel to your GUIDE GUI. This panel will have a tag (I can't remember what the default is for a panel, but you can find it easily enough in in the Property Inspector. That is the panel you need to use as the parent. Don't create a new one, and if you do, you certainly don't want to just give it some arbitrary input argument that appears to be a filename.
Your panel will be something like
handles.uipanel1
but as I say, I can't remember exactly what the default tag is. I always give my components a tag of my own name anyway so I know what they are.
Mochammad Fariz
on 25 Feb 2020
Mochammad Fariz
on 25 Feb 2020
Image Analyst
on 26 Feb 2020
Attach both your m-file and fig-file with the paper clip icon.
Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

