display info of pixel after for loop

2 次查看(过去 30 天)
Hi,
I am using a for loop over some weather data to indicate severity of a thunderstorm situation, see the code below.
I am wondering now, if I display the image with imagesc(), is there a way that by clicking on the pixel, the reason why this value is assigned will be displayed?
For example, if I click on a pixel with value 1, it would display a text box saying "because 10 < cape < 750 and shear < 20"
Thanks!
for i = 1:size(cape_fin,1)
for j = 1:size(cape_fin,2)
if cape_fin(i,j) > 10 && cape_fin(i,j) < 750 && shear_fin(i,j) < 20
hail_prob_level_fin(i,j) = 1;
elseif cape_fin(i,j) > 10 && cape_fin(i,j) < 750 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40
hail_prob_level_fin(i,j) = 2;
elseif cape_fin(i,j) > 10 && cape_fin(i,j) < 750 && shear_fin(i,j) > 40
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) < 6.6 || tlr_500_700_fin(i,j) < 7.3
hail_prob_level_fin(i,j) = 2;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) > 6.6 || tlr_500_700_fin(i,j) > 7.3
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) < 6.6 || tlr_500_700_fin(i,j) < 7.3
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) > 6.6 || tlr_500_700_fin(i,j) > 7.3
hail_prob_level_fin(i,j) = 4;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) < 20 && tlr_600_800_fin(i,j) > 7.3 || tlr_500_700_fin(i,j) > 7.9
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 750 && cape_fin(i,j) < 1300 && shear_fin(i,j) < 20 && tlr_600_800_fin(i,j) < 7.3 || tlr_500_700_fin(i,j) < 7.9
hail_prob_level_fin(i,j) = 2;
elseif cape_fin(i,j) > 1300 && cape_fin(i,j) < 2000 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) > 6.6 || tlr_500_700_fin(i,j) > 7.3
hail_prob_level_fin(i,j) = 4;
elseif cape_fin(i,j) > 1300 && cape_fin(i,j) < 2000 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) < 6.6 || tlr_500_700_fin(i,j) < 7.3
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 1300 && cape_fin(i,j) < 2000 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) < 7.3 || tlr_500_700_fin(i,j) < 7.9
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 1300 && cape_fin(i,j) < 2000 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) > 7.3 || tlr_500_700_fin(i,j) > 7.9
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 1300 && cape_fin(i,j) < 2000 && shear_fin(i,j) < 20
hail_prob_level_fin(i,j) = 3;
elseif cape_fin(i,j) > 2000 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) > 6.6 || tlr_500_700_fin(i,j) > 7.3
hail_prob_level_fin(i,j) = 5;
elseif cape_fin(i,j) > 2000 && shear_fin(i,j) > 40 && tlr_600_800_fin(i,j) < 6.6 || tlr_500_700_fin(i,j) < 7.3
hail_prob_level_fin(i,j) = 4;
elseif cape_fin(i,j) > 2000 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) < 7.3 || tlr_500_700_fin(i,j) < 7.9
hail_prob_level_fin(i,j) = 4;
elseif cape_fin(i,j) > 2000 && shear_fin(i,j) > 20 && shear_fin(i,j) < 40 && tlr_600_800_fin(i,j) > 7.3 || tlr_500_700_fin(i,j) > 7.9
hail_prob_level_fin(i,j) = 4;
elseif cape_fin(i,j) > 2000 && shear_fin(i,j) < 20
hail_prob_level_fin(i,j) = 4;
else
hail_prob_level_fin(i,j) = 1;
end
end
end

回答(1 个)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-6-20
编辑:KALYAN ACHARJYA 2019-6-20
improfile;
Read here
Is this are you looking for?

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by