Please how can I store values of variable size vectors inside a loop for
Show older comments
image processing
7 Comments
jonas
on 17 Aug 2018
Stephen23
on 17 Aug 2018
Probably in a cell array, or a structure, or a table, or...
But you question does not have enough information to know exactly what you are doing and what you would need.
Mohamed ouahidi
on 17 Aug 2018
jonas
on 17 Aug 2018
@Mohamed: If you want a detailed and precise answer then you need to figure out how to formulate the question accordingly. It still sounds like cell arrays will be useful for you, but it's difficult to say more than that based on the limited information.
Take a look at this guide on how to ask questions:
Stephen23
on 17 Aug 2018
The probleme exist in workspace the values of vectors subH(2) ....subH(n-1) are not stored
a=imread('pout.tif');
imshow(a); title('Original Image');
x = imhist(a);% vecteur d histogrm
maxHeight = max(x); % used to set limits for the histogram
% Split the original histogram into lenght of (idxX)
%idxX vector contains the minimas points of histogram image a
% first sub_histogram
subH_1=x( idxX(1): idxX(2) );
% Display the original and 1 sub-histograms
figure, stem(0:255, x,'.'); title('Original Histogram')
axis([0 260 0 maxHeight])
figure, stem( idxX(1): idxX(2,1) , subH_1, '.'); title('Sub-histogram 1');
axis([0 260 0 maxHeight])
% Display others sub-histograms
% n is known
for k= 2 : (n-1)
subH(k)= x( idxX(k) + 1 : idxX((k+1)) );
%figure;
%stem( idxX(k,1): idxX((k+1),1) , subHk, '.');
%axis([0 260 0 maxHeight])
end
Stephen23
on 18 Aug 2018
@Mohamed ouahidi: what values does n have? If it is less than three then that loop will not run.
Mohamed ouahidi
on 18 Aug 2018
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox 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!