How to get a only one table with a for loop?

2 ビュー (過去 30 日間)
Karina
Karina 2014 年 6 月 24 日
コメント済み: Ben11 2014 年 6 月 26 日
I have this code:
imDs=imread('10.png');
iGrisB = imDs(:, :, 3);
%Datos
media = mean(iGrisB(:));
Std=std(double(iGrisB(:)));
DMA=mad(double(iGrisB(:)));
display(media)
display(Std)
display(DMA)
Although it functions good,I have to copy and paste the results, and also I must do it for many images. It wastes to much time. So,what I need is getting the data of my images (almost 50 images) in a table. Then I thought in the next code:
for i=10:15%I used this only as an experiment
imDs=imread([num2str(i),'.png']);
iGrisB = imDs(:, :, 3);
%Datos
media = mean(iGrisB(:));
Std=std(double(iGrisB(:)));
DMA=mad(double(iGrisB(:)));
f=figure;
data = {media,Std,DMA};
ColNames={'Media','DS', 'DMA'};
uitable(f,'Data', data, 'ColumnName',ColNames, ...
'Position', [40 40 300 100]);
end
But the problem is that the data isn't in only one table, it gives me one table per image with 3 columns and one row. So, I need all my information in the same table. Thank you for your time. Regards.

採用された回答

Ben11
Ben11 2014 年 6 月 24 日
What if you take the following commands out of the for-loop?:
f=figure;
data = {media,Std,DMA};
ColNames={'Media','DS', 'DMA'};
uitable(f,'Data', data, 'ColumnName',ColNames, ...
'Position', [40 40 300 100]);
I can't try it right now, but creating a single table before entering the loop and then uptating the content as you go through the loop might do the trick.
  2 件のコメント
Karina
Karina 2014 年 6 月 25 日
Hi Ben, well the problem is that I already have tried to do that and it didn't function. I know that the real problem is to do the next:
data={mediai,Stdi,DMAi
media2,Std2,DMA2
media3,Std3,DMA3
...
mediaN,StdN,DMAN};
Where i=first image and N=last image. Maybe I have to apply a for in that, but I don't know how. Do you have any idea? Thank you. Regards.
Ben11
Ben11 2014 年 6 月 26 日
Hi Karina I saw that you posted a new question I just saw it sorry for not responding to you :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by