display info of pixel after for loop
Show older comments
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
Answers (1)
KALYAN ACHARJYA
on 20 Jun 2019
Edited: KALYAN ACHARJYA
on 20 Jun 2019
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!