Problem calculating standard deviation in a structure

1 view (last 30 days)
Hello,
I have a 1x16 structure named jj containing another 2 structures called PixelValues and StandardDeviation. Inside PixelValues I have 16 images, where each of them contains different number of regions that contain different number of pixel intensities (for example first image consists of 21x1 structure with 21 regions, each of them with different number of pixel intensities).
Here is my code for calculating std fore this structure PixelValues that I am having trouble with:
numPix - this is a 16x1 double I created containing total number of different number of inregions of each image
numPixx - I converted it to 16x1 cell
for kk = 1:numPix
for iiii=1:numel(numPixx):1 %with this line I get the std calculated for only first image containing 21 regions with different values (21x1 struct)
jj(iii{iiii}).StandardDeviation(kk).Var1 = std(double([jj(iii{iiii}).PixelValues(kk).Var1]));
end
end
The problem that I have is calculating a standard deviation for all structures inside PixelValues inside my jj structure. I was able to calculate std for only the first image but I failed to calculate it for other 15. I am strugling to write a for loop that can do that thru all images inside my jj structure. My goal is to get the new structure StandardDeviation that contains separate single values of standard deviation of all those regions inside PixelValues .
I hope that I explained it for everybodu to understand. I attached 1 image to better clarify how my structures looks like.
Thanks in advance!
  1 Comment
Mario
Mario on 13 Apr 2015
I managed to get it to work!
The problem that I had was involving structures and cells inside my for loops which I managed to solve by adding another for loop.

Sign in to comment.

Answers (0)

Categories

Find more on Denoising and Compression 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!